home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / kernel / xoper20.1 < prev    next >
Internet Message Format  |  1989-10-28  |  66KB

  1. Path: xanth!ames!sun-barr!newstop!sun!swap!root
  2. From: root%swap@Sun.COM (Operator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i190:  xoper - examine & control your kernel, Part01/03
  5. Message-ID: <127005@sun.Eng.Sun.COM>
  6. Date: 28 Oct 89 07:15:31 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 2844
  9. Approved: page@sun.com
  10.  
  11. Submitted-by: g35@dhdurz1@bitnet (Werner Guenther)
  12. Posting-number: Volume 89, Issue 190
  13. Archive-name: kernel/xoper20.1
  14.  
  15. Changes in V2.0:
  16.  
  17. The user interface has been rewritten from scratch, and a small iconify
  18. routine has been added.
  19.  
  20. To customize the whole thing a little bit, there are a few new commands:
  21.  MinimumChars, HistoryLines, ShowHistory, KillHistory, OutputLines,
  22.  IconifyOff, BackDropIcon, UseScreen, UseWindow.
  23. Other new commands include:
  24.  TimerIO, RemResident, Repeat, TrapGuru, Setfont, DiskChange, Alias,
  25.  SaveOutput.
  26.  
  27. Addresses are now shown as 32-Bit values for 68020 compatibility.
  28. 'display commands' separated by blanks will display the lists
  29. one by one rather than all at once.
  30. The 'interrupt list' has two new fields.
  31. 'Time' w/o parameters shows current setting.
  32. The 'More' command is obsolete and has been removed.
  33.  
  34. [NOTE: The source file was too big to fit in one posting, so I broke
  35. it into three parts, labeled xoper.a1 though xoper.a3.  Once you
  36. unshar all three parts, join the three .aX files into Xoper.a ..bob]
  37.  
  38. # This is a shell archive.
  39. # Remove anything above and including the cut line.
  40. # Then run the rest of the file through 'sh'.
  41. # Unpacked files will be owned by you and have default permissions.
  42. #----cut here-----cut here-----cut here-----cut here----#
  43. #!/bin/sh
  44. # shar: SHell ARchive
  45. # Run the following text through 'sh' to create:
  46. #    xoper.a1
  47. # This is archive 1 of a 3-part kit.
  48. # This archive created: Fri Oct 27 23:48:52 1989
  49. echo "extracting xoper.a1"
  50. sed 's/^X//' << \SHAR_EOF > xoper.a1
  51. X******************************************
  52. X*                     *
  53. X* Xoper 2.0 Copyright (C) Werner Gunther *
  54. X*                     *
  55. X******************************************
  56. X*    Written for the A68K Assembler     *
  57. X*   (Fish 110) by Charlie Gibbs and      *
  58. X*       Brian R. Anderson         *
  59. X*                     *
  60. X*  Do not use Smallcode/Smalldata when     *
  61. X*          linking             *
  62. X******************************************
  63. X;DEBUG SET 1
  64. X        XREF    _LVOSwitch
  65. X        XREF    _LVOAddTask
  66. X        XDEF    _SysBase
  67. Xsysbase     equ     4
  68. X
  69. XCALL        MACRO
  70. X        xref    _LVO\1
  71. X        move.l  \2,a6
  72. X        jsr     _LVO\1(a6)
  73. X        ENDM
  74. XLIBCALL     MACRO
  75. X        xref    _\1
  76. X        jsr     _\1
  77. X        ENDM
  78. X
  79. XADDCMD        MACRO
  80. Xcmdnum        set     cmdnum+1
  81. X        dc.b    \1,0
  82. X        ENDM
  83. X
  84. X;Program startup. If called from DOS we
  85. X;use segment splitting to detach
  86. X;from our DOS-task.
  87. Xstart        moveq   #3,d0
  88. X        lea     dummyinput,a1
  89. Xgetparm     move.b  (a0)+,(a1)+
  90. X        dbf     d0,getparm
  91. X        move.b  #10,in
  92. X        lea     conname(PC),a1
  93. X        move.l  sysbase,a0
  94. X        lea     350(a0),a0
  95. X        CALL    FindName,sysbase
  96. X        move.l  d0,condev
  97. X        lea     dosname(PC),a1
  98. X        move.l  sysbase,a0
  99. X        lea     378(a0),a0
  100. X        move.l  a0,-(a7)
  101. X        CALL    FindName,sysbase
  102. X        move.l  d0,dosbase
  103. X        move.l  0(a7),a0
  104. X        lea     gfxname(PC),a1
  105. X        CALL    FindName,sysbase
  106. X        move.l  d0,gfxbase
  107. X        move.l  (a7)+,a0
  108. X        lea     intuiname(PC),a1
  109. X        CALL    FindName,sysbase
  110. X        move.l  d0,intuibase
  111. X        move.l  d0,a0
  112. X        move.l  $38(a0),a0
  113. X        move.w  12(a0),d0
  114. X        sub.w   #550,d0
  115. X        move.w  d0,window_l
  116. X
  117. X        move.l  sysbase,a4
  118. X        move.l  276(a4),a4
  119. X        tst.l   $ac(a4)
  120. X        bne.s   notwb
  121. X        lea     $5c(a4),a0
  122. X        CALL    WaitPort,sysbase
  123. X        lea     $5c(a4),a0
  124. X        CALL    GetMsg,sysbase
  125. X        move.l  d0,wbmsg
  126. X        move.w  #$740a,in
  127. Xnotwb:
  128. X       IFND  DEBUG
  129. X        lea     xopcon,a1
  130. X        CALL    FindPort,sysbase
  131. X        tst.l   d0
  132. X        bne     oops
  133. X       ENDC
  134. X        tst.l   wbmsg
  135. X        beq.s   fromdos
  136. X        jmp     mainprg
  137. X
  138. Xfromdos:
  139. X
  140. Xstarttask:
  141. X
  142. X    IFND DEBUG
  143. X        cmp.w   #'-b',dummyinput
  144. X        bne.s   stt1
  145. X        CALL    Output,dosbase
  146. X        move.l  d0,-(a7)
  147. X        move.l  #windowname,d2
  148. X        move.l  d0,d1
  149. X        moveq.l #newname-windowname-1,d3
  150. X        CALL    Write,dosbase
  151. X        move.l  #cr,d2
  152. X        move.l  (a7)+,d1
  153. X        moveq.l #1,d3
  154. X        CALL    Write,dosbase
  155. Xstt1        lea     start(PC),a1
  156. X        move.l  -4(a1),d3
  157. X        move.l  d3,myseg
  158. X
  159. X        move.l  #mainprg,d3
  160. X        subq    #4,d3
  161. X        lsr.l   #2,d3
  162. X
  163. X        clr.l   -4(a1)
  164. X        CALL    Forbid,sysbase
  165. X        move.l  #newname,d1
  166. X        clr.l   d2
  167. X        move.l  #3500,d4
  168. X        CALL    CreateProc,dosbase
  169. X        CALL    Permit,sysbase
  170. X        moveq   #0,d0
  171. X        rts
  172. Xoops        suba.l  a0,a0
  173. X        CALL    DisplayBeep,intuibase
  174. X        CALL    Forbid,sysbase
  175. X        move.l  wbmsg,d0
  176. X        beq.s   leave
  177. X        move.l  d0,a1
  178. X        CALL    ReplyMsg,sysbase
  179. X        moveq   #0,d0
  180. Xleave        rts
  181. X
  182. Xdosname     dc.b    'dos.library',0
  183. Xintuiname   dc.b    'intuition.library',0
  184. Xgfxname     dc.b    'graphics.library',0
  185. Xconname     dc.b    'console.device',0
  186. X        EVEN
  187. X
  188. Xmain        CODE    xoper
  189. X    ENDC
  190. Xmainprg     move.l  sysbase,a0
  191. X        move.l  a0,_SysBase
  192. X        move.l  a7,realstack
  193. X        move.l  276(a0),a0          ;ExecBase->ThisTask
  194. X        move.l  a0,mytask
  195. X        move.l  50(a0),oldproctrap  ;original AmigaDos Trap-Handler
  196. X        move.l  #newname,10(a0)
  197. X        pea     0
  198. X        pea     xopcon
  199. X        LIBCALL CreatePort
  200. X        addq    #8,a7
  201. X        move.l  d0,replyport
  202. X        pea     0
  203. X        pea     0
  204. X        LIBCALL CreatePort
  205. X        addq    #8,a7
  206. X        move.l  d0,timerport
  207. X        lea     timerio,a1
  208. X        move.l  d0,14(a1)
  209. X        move.l  d0,a2
  210. X        move.b  15(a2),d0
  211. X        ext.w   d0
  212. X        move.w  d0,timersig
  213. X        lea     timernam(PC),a0
  214. X        moveq   #0,d1
  215. X        moveq   #1,d0
  216. X        CALL    OpenDevice,_SysBase(PC) ;open 'timer.device'
  217. X
  218. X;install a counter to determine the amount of CPU-time each
  219. X;Task uses.
  220. X        move.l  _SysBase(PC),a1
  221. X        move.l  #_LVOSwitch,a0
  222. X        move.l  2(a1,a0),oldswitch
  223. X        move.l  #myswitch,d0
  224. X        CALL    SetFunction,_SysBase(PC)
  225. X;install a counter for PORT-Interrupts
  226. X        lea     IOCounter(PC),a1
  227. X        moveq   #3,d0
  228. X        CALL    AddIntServer,_SysBase(PC)
  229. X
  230. X;Attempt to open a startup script
  231. X        move.l  mytask(PC),a4      ;disable the 'please insert'
  232. X        move.l  184(a4),-(a7)
  233. X        move.l  #-1,184(a4)        ;requester
  234. X        move.l  #startupname+2,d1  ;'Xoper.Startup'
  235. X        move.l  #1005,d2
  236. X        CALL    Open,dosbase(PC)
  237. X        tst.l   d0
  238. X        bne.s   7$
  239. X        move.l  #startupname,d1    ;'S:Xoper.Startup'
  240. X        move.l  #1005,d2
  241. X        CALL    Open,dosbase(PC)
  242. X
  243. X7$        move.l  (a7)+,184(a4)      ;reenable the requester
  244. X        move.l  d0,infile
  245. X        beq.s   nostartup
  246. X
  247. X6$        move.b  #1,fromfile
  248. X
  249. X8$        lea     dummy,a5
  250. X        moveq   #-1,d5
  251. X5$        addq.l  #1,d5
  252. X        move.l  infile(PC),d1
  253. X        move.l  a5,d2
  254. X        add.l   d5,d2
  255. X        moveq.l #1,d3
  256. X        CALL    Read,dosbase(PC)
  257. X        tst.l   d0
  258. X        bgt.s   10$
  259. X
  260. X        move.l  infile(PC),d1
  261. X        CALL    Close,dosbase(PC)
  262. X        clr.l   infile
  263. X        tst     d5
  264. X        beq.s   endstartup
  265. X        bra.s   9$
  266. X
  267. X10$        cmp.b   #10,0(a5,d5)
  268. X        beq.s   9$
  269. X        cmp.b   #13,0(a5,d5)
  270. X        bne.s   5$
  271. X
  272. X9$        move.l  d5,d0
  273. X        addq    #1,d0
  274. X        bsr     cli            ;execute the script as if typed in
  275. X        tst.l   infile
  276. X        bne.s   8$
  277. X
  278. Xendstartup  clr.b   fromfile
  279. X
  280. Xnostartup   tst.l   wbmsg
  281. X        bne.s   noin
  282. X        cmp.b   #10,dummyinput
  283. X        beq.s   noin
  284. X        cmp.w   #'-b',dummyinput   ;requested as a background task ?
  285. X        beq.s   noin
  286. X        move.l  dummyinput,in
  287. X        move.b  #10,in+4
  288. X        bra.s   nostartup2
  289. Xnoin        cmp.b   #10,in
  290. X        beq.s   default
  291. X        tst.b   in
  292. X        bne.s   nostartup2
  293. X
  294. Xdefault     move.w  #$740a,in           ;couldn't find defaults, defaults to
  295. X                       ;tasks
  296. X
  297. Xnostartup2  cmp.w   #'-b',dummyinput
  298. X        beq     instback
  299. X
  300. X;This code just opens a Window. Position
  301. X;and size are taken from window_l,window_t,
  302. X;window_w,window_h.
  303. Xrestart     tst.b   ownscreen
  304. X        beq.s   1$
  305. X        bsr     createscreen
  306. X        bra.s   2$
  307. X1$        bsr     setupwindow
  308. X
  309. X2$        move.l  mytask(PC),a0
  310. X        clr.l   26(a0)              ;clear 'spurious' signals
  311. X
  312. X        clr.l   ptr
  313. X        tst.b   gotguru
  314. X
  315. X        beq.s   3$
  316. X        bsr     showguru
  317. X        clr.b   gotguru
  318. X3$        bra     processmsgs
  319. X
  320. X;show a list. The string entered from keyboard is stored
  321. X;in 'in'.Every character is interpreted as one command
  322. X;i.e. 'rip' means 'resources'+'interrupts'+'ports'.
  323. X;search the command to be executed. If none is found,
  324. X;show a help message
  325. X
  326. Xshowwhat    tst.b   fromfile
  327. X        bne     endshow
  328. X        move.w  cmdptr(PC),d7
  329. X
  330. Xinput        lea     in,a0
  331. X        move.b  0(a0,d7.w),d0
  332. X        beq     endshow
  333. X        addq.b  #1,d7
  334. X        cmpi.b  #' ',d0
  335. X        bne.s   1$
  336. X
  337. X        bsr     testifend
  338. X        beq     endshow
  339. X        move.w  d2,cmdptr
  340. X        bra     notfinished
  341. X
  342. X1$        cmpi.b  #10,d0
  343. X        beq     endshow
  344. X        or.b    #32,d0
  345. X        cmpi.b  #'q',d0
  346. X        beq     exit
  347. X        lea     params(PC),a0
  348. X        moveq   #0,d1
  349. Xi1        cmp.b   0(a0,d1),d0
  350. X        beq.s   foundp
  351. X        addq.b  #1,d1
  352. X        cmpi.b  #parmnum,d1
  353. X        bne.s   i1
  354. X
  355. X        move.l  #usetxt,d0
  356. X        move.b  #1,mnflag
  357. X        bsr     putnam
  358. X        clr.b   mnflag
  359. X        bra     endshow
  360. X
  361. Xfoundp        lsl.b   #2,d1
  362. X        lea     subs(PC),a0
  363. X        move.b  #1,mnflag
  364. X        jsr     0(a0,d1)
  365. X        clr.b   mnflag
  366. X        bsr     testifend
  367. X        beq     input
  368. X        bsr     newline
  369. X        bra     input
  370. X
  371. Xtestifend   lea     in,a0
  372. X        lea     0(a0,d7),a0
  373. X        move.w  d7,d2
  374. X2$        move.b  (a0)+,d0
  375. X        beq.s   1$
  376. X        cmpi.b  #' ',d0
  377. X        bne.s   3$
  378. X        addq    #1,d2
  379. X        bra.s   2$
  380. X3$        cmpi.b  #10,d0
  381. X1$        rts
  382. X
  383. X
  384. Xendshow     tst.b   fromfile
  385. X        bne.s   nomore
  386. X        clr.w   cmdptr
  387. Xnotfinished bsr     starttimer
  388. Xnomore        tst.b   fromfile
  389. X        bne.s   1$
  390. X        clr.l   lastprinted
  391. X        bsr     blastout
  392. X1$        rts
  393. X
  394. X;get the string from inputbuffer; search and execute
  395. X;the command, if any.
  396. X
  397. Xcli        lea     dummy,a0
  398. X        subq    #1,d0
  399. Xcl2        subq    #1,d0
  400. X        bmi.s   cl1
  401. X        cmp.b   #' ',0(a0,d0)
  402. X        beq.s   cl2
  403. Xcl1        addq    #1,d0
  404. X        move.b  #10,0(a0,d0)
  405. X        bsr     kllblnks
  406. X        cmpi.b  #10,0(a0)
  407. X        beq     showwhat
  408. X        cmpi.b  #';',0(a0)
  409. X        beq     nomore
  410. X
  411. X        bsr     findcmd
  412. X        tst.l   d2
  413. X        bpl.s   okcmd
  414. X        bsr     findalias
  415. X        tst.l   d2
  416. X        bmi.s   nm1
  417. X
  418. Xokcmd        clr.b   procnum
  419. X        adda.w  d1,a0
  420. X        bsr     kllblnks
  421. X        lsl     #2,d2
  422. X        lea     cmdaddr(PC),a1
  423. X        jsr     0(a1,d2)
  424. X        bra     nomore
  425. X
  426. Xnm1        lea     in,a1
  427. X        lea     buffer,a2
  428. Xnm2        move.b  (a1)+,(a2)+
  429. X        cmp.b   #10,-1(a1)
  430. X        bne.s   nm2
  431. X        lea     in,a1
  432. Xnm0        move.b  (a0)+,(a1)+
  433. X        cmp.b   #10,-1(a1)
  434. X        bne.s   nm0
  435. X        lea     dummy,a2
  436. X        lea     buffer,a1
  437. Xnm3        move.b  (a1)+,(a2)+
  438. X        cmp.b   #10,-1(a1)
  439. X        bne.s   nm3
  440. X        clr.w   cmdptr
  441. X        bra     showwhat
  442. X
  443. Xfindcmd     bsr     strbuf
  444. X        move.l  a0,a5
  445. X        lea     commds(PC),a2
  446. X        moveq   #0,d2
  447. X1$        lea     buffer,a0
  448. X        move.l  a2,a1
  449. X        bsr     strcmp
  450. X        beq     3$
  451. X2$        tst.b   (a2)+
  452. X        bne.s   2$
  453. X        addq    #1,d2
  454. X        cmp.w   #cmdnum,d2
  455. X        bne.s   1$
  456. X        moveq   #-1,d2
  457. X3$        move.l  a5,a0
  458. X        rts
  459. X
  460. Xfindalias   move.l  a0,a5
  461. X        move.l  aliaslist(PC),d4
  462. X1$        beq.s   3$
  463. X        move.l  d4,a4
  464. X        lea     buffer,a0
  465. X        lea     5(a4),a1
  466. X        move.b  4(a4),d2
  467. X        ext.w   d2
  468. X        ext.l   d2
  469. X        bsr     strcmp
  470. X        beq     4$
  471. X        move.l  0(a4),d4
  472. X        bra.s   1$
  473. X3$        moveq   #-1,d2
  474. X4$        move.l  a5,a0
  475. X        rts
  476. X
  477. Xsubs        bra     showtask
  478. X        bra     showaddr
  479. X        bra     showdevs
  480. X        bra     showlibs
  481. X        bra     showres
  482. X        bra     showresi
  483. X        bra     showmem
  484. X        bra     showprt
  485. X        bra     showint
  486. X        bra     stack
  487. X        bra     clicomm
  488. Xcmdaddr     bra     settime
  489. X        bra     taskpri
  490. X        bra     info
  491. X        bra     pri
  492. X        bra     flush
  493. X        bra     freeze
  494. X        bra     warm
  495. X        bra     signal
  496. X        bra     break
  497. X        bra     alert
  498. X        bra     lastalert
  499. X        bra     hold
  500. X        bra     stopall
  501. X        bra     clear
  502. X        bra     cancel
  503. X        bra     taskports
  504. X        bra     hunks
  505. X        bra     devices
  506. X        bra     openlib
  507. X        bra     closelib
  508. X        bra     currentdir
  509. X        bra     cd
  510. X        bra     mypri
  511. X        bra     openfiles
  512. X        bra     locks
  513. X        bra     unlock
  514. X        bra     screens
  515. X        bra     windows
  516. X        bra     closescreen
  517. X        bra     closewindow
  518. X        bra     fonts
  519. X        bra     windowfonts
  520. X        bra     lockdrive
  521. X        bra     freedrive
  522. X        bra     capture
  523. X        bra     clrcold
  524. X        bra     clrcool
  525. X        bra     clrwarm
  526. X        bra     snoop
  527. X        bra     usage
  528. X        bra     inphand
  529. X        bra     nohead
  530. X        bra     sort
  531. X        bra     hide
  532. X        bra     hidden
  533. X        bra     setwindow
  534. X        bra     cancel
  535. X        bra     iconifyoff
  536. X        bra     historylines
  537. X        bra     historylength
  538. X        bra     showhistory
  539. X        bra     repeatcmd
  540. X        bra     remresident
  541. X        bra     saveoutput
  542. X        bra     killhistory
  543. X        bra     iconbackdrp
  544. X        bra     setfont
  545. X        bra     trapguru
  546. X        bra     outputlines
  547. X        bra     usescreen
  548. X        bra     usewindow
  549. X        bra     grabtimerio
  550. X        bra     dchange
  551. X        bra     alias
  552. X        bra     remnode
  553. X
  554. X;------ Task-Structures-----
  555. X
  556. Xshowaddr    clr.b   tasktyp
  557. X        bra.s   startask
  558. Xshowtask    move.b  #1,tasktyp
  559. Xstartask    tst.b   headon
  560. X        beq     noheader1
  561. X        move.l  #infoh1,d0
  562. X        bsr     putstr
  563. X        move.l  _SysBase(PC),a6
  564. X        move.l  #cpu2,d0
  565. X        btst    #1,297(a6)      ;SysBase->AttnFlags
  566. X        bne.s   cpupr
  567. X        move.l  #cpu1,d0
  568. X        btst    #0,297(a6)
  569. X        bne.s   cpupr
  570. X        move.l  #cpu0,d0
  571. Xcpupr        bsr     putstr
  572. X        move.l  _SysBase(PC),a6
  573. X        btst    #2,297(a6)
  574. X        beq.s   no881
  575. X        move.l  #cpu3,d0
  576. X        bsr     putstr
  577. Xno881        moveq   #20,d1
  578. X        bsr     tab
  579. X        move.l  #infoh3,d0
  580. X        bsr     putstr
  581. X
  582. Xnoheader1   move.l  _SysBase(PC),a6
  583. X        move.w  #$4000,$dff09a
  584. X        move.l  280(a6),d0
  585. X        move.l  284(a6),d1
  586. X        move.l  oldidl,d3
  587. X        move.l  d0,oldidl
  588. X        sub.l   d3,d0
  589. X        move.l  olddisp,d3
  590. X        move.l  d1,olddisp
  591. X        sub.l   d1,d3
  592. X        move.l  d0,d1
  593. X        sub.l   d3,d1
  594. X        move.l  d1,maxdisp
  595. X        move.l  d3,-(a7)
  596. X        movem.l d0-d3,-(a7)
  597. X        moveq   #1,d5
  598. X        bsr     getaskdat
  599. X        move.l  a5,savedat
  600. X        movem.l (a7)+,d0-d3
  601. X        sub.l   d3,d0
  602. X        neg.l   d3
  603. X        tst.b   headon
  604. X        beq.s   noheader2
  605. X        bsr     prcent
  606. X        bsr     newline
  607. X        move.l  #infoh2,d0
  608. X        bsr     putstr
  609. Xnoheader2   move.l  (a7)+,d0
  610. X        neg.l   d0
  611. X        move.l  d0,dispatches
  612. X        tst.b   headon
  613. X        beq     noheader3
  614. X        mulu    #100,d0
  615. X        move.l  d0,-(a7)
  616. X
  617. X        lea     secs(PC),a0
  618. X        lea     mics(PC),a1
  619. X        CALL    CurrentTime,intuibase(PC)
  620. X        move.l  secs(PC),d3
  621. X        lsl.l   #1,d3
  622. X        move.l  d3,d1
  623. X        lsl.l   #2,d3
  624. X        add.l   d1,d3
  625. X        move.l  mics(PC),d0
  626. X        move.l  #100000,d1
  627. X        bsr     div
  628. X        add.l   d0,d3
  629. X        move.l  time10(PC),d1
  630. X        move.l  d3,time10
  631. X        sub.l   d1,d3
  632. X        move.l  (a7)+,d0
  633. X        move.l  d3,-(a7)
  634. X        move.l  d3,d1
  635. X        bsr     div
  636. X        moveq   #1,d5
  637. X        bsr     putfrac
  638. X
  639. X        moveq   #20,d1
  640. X        bsr     tab
  641. X        move.l  #infoh7,d0
  642. X        bsr     putstr
  643. X        move.l  iocount(PC),d0
  644. X        clr.l   iocount
  645. X        mulu    #100,d0
  646. X        move.l  (a7)+,d3
  647. X        move.l  d3,d1
  648. X        bsr     div
  649. X        moveq   #1,d5
  650. X        bsr     putfrac
  651. X
  652. X        bsr     newline
  653. X        bsr     newline
  654. Xnoheader3   lea     theader(PC),a0
  655. X        tst.b   tasktyp
  656. X        bne.s   phedder
  657. X        lea     t2header(PC),a0
  658. Xphedder     bsr     puthead
  659. X        move.l  savedat(PC),a5
  660. X
  661. Xpt1        tst.b   entries
  662. X        beq     pt2
  663. X        lea     -16(a5),a5
  664. X        bsr     hideit
  665. X        tst     d0
  666. X        beq     ptend
  667. X        move.l  0(a5),a4
  668. X        move.l  a4,d0
  669. X        move.l  d0,node
  670. X        bsr     hexa
  671. X        tst.b   tasktyp
  672. X        beq.s   pt12
  673. X        moveq   #0,d0
  674. X        move.b  8(a4),d0
  675. X        bsr     gettype
  676. X
  677. Xpt12        moveq   #0,d0
  678. X        move.b  9(a5),d0
  679. X        subq.b  #1,d0
  680. X        mulu    #10,d0
  681. X        move.l  #status,d1
  682. X        add.l   d1,d0
  683. X        bsr     putstr
  684. X        tst.b   tasktyp
  685. X        bne.s   pt13
  686. X
  687. X        move.l  18(a4),d0
  688. X        bsr     hexa
  689. X        move.l  #longnix,d0
  690. X        cmp.b   #4,9(a5)
  691. X        beq.s   pt14
  692. X        bsr     putstr
  693. X        bra.s   pt15
  694. Xpt14        move.l  22(a4),d0
  695. X        bsr     hexa
  696. Xpt15        move.l  26(a4),d0
  697. X        bsr     hexa
  698. X        move.l  54(a4),a1
  699. X        move.l  0(a1),d0
  700. X        cmp.b   #2,9(a5)
  701. X        bne.s   pt16
  702. X        move.l  #*,d0
  703. Xpt16        bsr     hexa
  704. X        bra     pt4
  705. X
  706. Xpt13        move.b  10(a5),d3
  707. X        bsr     plusmins
  708. X
  709. X        move.l  dispatches(PC),d0
  710. X        tst.b   usageflag
  711. X        beq.s   pt37
  712. X        move.l  maxdisp(PC),d0
  713. Xpt37        move.l  12(a5),d3
  714. X        bsr     prcent
  715. X
  716. X        clr.b   d3
  717. X        cmpi.b  #13,8(a5)
  718. X        bne.s   noproc
  719. X        tst.l   172(a4)
  720. X        beq.s   noproc
  721. X        move.b  11(a5),d3
  722. X        bsr     bytedec
  723. X        bra.s   pt4
  724. Xnoproc        move.l  #nix,d0
  725. X        bsr     putstr
  726. Xpt4        move.l  4(a5),d0
  727. X        bsr     putnam
  728. Xptend        subq.b  #1,entries
  729. X        bra     pt1
  730. Xpt2        rts
  731. X
  732. Xputlist     move.l  0(a4),a4
  733. X        tst.l   0(a4)
  734. X        beq.s   endlist
  735. X        bsr     putdata
  736. X        bra.s   putlist
  737. Xendlist     rts
  738. X
  739. Xputdata     move.l  a4,0(a5)
  740. X        move.l  10(a4),4(a5)        ;task->ln_Name
  741. X        move.b  8(a4),8(a5)         ;task->ln_Type
  742. X        move.b  15(a4),9(a5)        ;task->tc_State
  743. X        move.b  9(a4),10(a5)        ;task->ln_Pri
  744. X        move.b  143(a4),11(a5)      ;Process->pr_Tasknum
  745. X        clr.l   12(a5)
  746. X        lea     cputime,a0
  747. X        move.l  tasksnum(PC),d1
  748. X        subq    #1,d1
  749. X        bmi.s   pua1
  750. Xpua3        cmp.l   (a0)+,a4
  751. X        dbeq    d1,pua3
  752. X        tst     d1
  753. X        bmi.s   pua1
  754. Xpua2        move.l  508(a0),12(a5)
  755. Xpua1        lea     16(a5),a5
  756. X        addq.b  #1,entries
  757. X        rts
  758. X
  759. Xgettype     and.l   #$f,d0
  760. X        mulu    #11,d0
  761. X        add.l   #type,d0
  762. X        bra     putstr
  763. X
  764. Xgetaskdat   move.l  d5,-(a7)
  765. X        lea     buffer,a5
  766. X        clr.b   entries
  767. X        lea     stplist(PC),a4
  768. X        bsr     putlist
  769. X        move.l  _SysBase(PC),a4
  770. X        lea     420(a4),a4          ;SysBase->TaskWait
  771. X        bsr     putlist
  772. X        move.l  _SysBase(PC),a4
  773. X        lea     406(a4),a4          ;SysBase->TaskReady
  774. X        bsr     putlist
  775. X        move.l  _SysBase(PC),a4
  776. X        move.l  276(a4),a4          ;SysBase->ThisTask
  777. X        bsr     putdata
  778. X        move.l  (a7)+,d5
  779. X        beq.s   1$
  780. X        clr.l   tasksnum
  781. X1$        move.w  #-$4000,$dff09a
  782. X        moveq   #16,d2
  783. X        lea     -32(a5),a2
  784. X        bsr.s   sortlist
  785. X        rts
  786. X
  787. Xsortlist    tst.b   sorton
  788. X        beq.s   sort5
  789. X        lea     buffer,a3
  790. Xsort1        lea     0(a3,d2),a4
  791. Xsort2        move.l  0(a3),d1
  792. X        cmp.l   0(a4),d1
  793. X        bge.s   sort3
  794. X        move.l  d2,d1
  795. X        subq    #1,d1
  796. Xsort4        move.b  0(a4,d1),d0
  797. X        move.b  0(a3,d1),0(a4,d1)
  798. X        move.b  d0,0(a3,d1)
  799. X        dbf     d1,sort4
  800. Xsort3        lea     0(a4,d2),a4
  801. X        cmp.l   a2,a4
  802. X        ble.s   sort2
  803. X        lea     0(a3,d2),a3
  804. X        cmp.l   a2,a3
  805. X        bne.s   sort1
  806. Xsort5        rts
  807. X
  808. Xprcent        lsl.l   #1,d3
  809. X        move.l  d3,d1
  810. X        lsl.l   #2,d3
  811. X        add.l   d1,d3
  812. X        lsl.l   #2,d3
  813. X        move.l  d3,d1
  814. X        lsl.l   #3,d3
  815. X        move.l  d3,d2
  816. X        lsl.l   #1,d3
  817. X        add.l   d2,d3
  818. X        add.l   d1,d3
  819. X        move.l  d0,d1
  820. X        move.l  d3,d0
  821. X        bsr     div
  822. X        moveq   #0,d5
  823. X        bsr     putfrac
  824. X        move.l  #infoh4,d0
  825. X        bra     putstr
  826. X
  827. Xputfrac     divu    #10,d0
  828. X        move    d0,d3
  829. X        swap    d0
  830. X        move    d0,d1
  831. X        tst     d5
  832. X        bne.s   1$
  833. X        cmp.w   #100,d3
  834. X        ble.s   1$
  835. X        move.l  #whatsthis,d0
  836. X        bra     putstr
  837. X1$        bsr     bytedec
  838. X        lea     out,a0
  839. X        move.b  #'.',-1(a0,d0)
  840. X        or.b    #'0',d1
  841. X        move    d1,d0
  842. X        bra     putchar
  843. X
  844. Xhideit        tst.b   hideon
  845. X        bne.s   pt73
  846. Xpt75        moveq   #1,d0
  847. X        rts
  848. Xpt73        lea     hidestart(PC),a4
  849. X        move.l  4(a5),a0
  850. Xpt74        tst.l   0(a4)
  851. X        beq.s   pt75
  852. X        move.l  0(a4),a4
  853. X        lea     4(a4),a1
  854. X        bsr     strcmp
  855. X        tst     d0
  856. X        beq     hideend
  857. X        bra.s   pt74
  858. Xhideend     rts
  859. X*-------- mem-hunks ------------
  860. X
  861. Xshowmem     lea     mheader(PC),a0
  862. X        bsr     puthead
  863. X        move.l  _SysBase(PC),a5
  864. X        lea     322(a5),a5          ;SysBase->MemList
  865. X        moveq   #0,d5
  866. Xmem1        move.l  0(a5),a5            ;MemList->ln_Next
  867. X        tst.l   0(a5)
  868. X        beq.s   mem2
  869. X        move.l  20(a5),d0           ;MemHeader->mh_Lower
  870. X        bsr     hexa
  871. X        move.l  24(a5),d0           ;MemHeader->mh_Upper
  872. X        bsr     hexa
  873. X        move.l  28(a5),d0           ;MemHeader->mh_Free
  874. X        add.l   d0,d5
  875. X        moveq   #1,d3
  876. X        bsr     longdec
  877. X        move.b  15(a5),d3           ;MemHeader->mh_Attributes
  878. X        bsr     bytedec
  879. X        move.b  9(a5),d3            ;MemHeader->ln_pri
  880. X        bsr     plusmins
  881. X        move.l  10(a5),d0           ;MemHeader->ln_Name
  882. X        move.l  a5,node
  883. X        bsr     putnam
  884. X        bra.s   mem1
  885. Xmem2        move.l  #infoh6,d0
  886. X        bsr     putstr
  887. X        moveq   #19,d1
  888. X        bsr     tab
  889. X        moveq   #0,d3
  890. X        move.l  d5,d0
  891. X        bsr     longdec
  892. Xnewline     move.l  #cr,d0
  893. X        bra     putstr
  894. X
  895. X*-------- Task-Stack ------------
  896. X
  897. Xstack        lea     stackhead(pc),a0
  898. X        bsr     puthead
  899. X        moveq   #0,d5
  900. X        bsr     getaskdat
  901. Xsta1        tst.b   entries
  902. X        beq     sta8
  903. X        lea     -16(a5),a5
  904. X        bsr     hideit
  905. X        tst     d0
  906. X        beq     sta9
  907. X        move.l  0(a5),a1
  908. X        cmp.b   #13,8(a1)               ;task->ln_Type
  909. X        bne.s   sta6
  910. X        move.l  172(a1),d0
  911. X        beq.s   sta6
  912. X        lsl.l   #2,d0
  913. X        move.l  d0,a0
  914. X        tst.l   60(a0)
  915. X        beq.s   sta6
  916. X        moveq   #1,d3
  917. X        move.l  52(a0),d4
  918. X        lsl.l   #2,d4
  919. X        move.l  176(a1),d0
  920. X        sub.l   d4,d0
  921. X        bsr     hexa
  922. X        move.l  d4,d0
  923. X        bsr     longdec
  924. X        move.l  176(a1),d0
  925. X        sub.l   54(a1),d0
  926. X        bra.s   sta7
  927. X
  928. Xsta6        move.l  58(a1),d0
  929. X        bsr     hexa
  930. X        moveq   #1,d3
  931. X        move.l  62(a1),d0
  932. X        sub.l   58(a1),d0
  933. X        bsr     longdec
  934. X        move.l  62(a1),d0
  935. X        sub.l   54(a1),d0
  936. Xsta7        bsr     longdec
  937. X        move.l  4(a5),d0
  938. X        bsr     putnam
  939. Xsta9        subq.b  #1,entries
  940. X        bra     sta1
  941. Xsta8        rts
  942. X
  943. Xclicomm     lea     clicomhead(pc),a0
  944. X        bsr     puthead
  945. X        moveq   #0,d5
  946. X        bsr     getaskdat
  947. Xclic1        tst.b   entries
  948. X        beq     clic8
  949. X        lea     -16(a5),a5
  950. X        bsr     hideit
  951. X        tst     d0
  952. X        beq     clic0
  953. X        move.l  0(a5),a4
  954. X        cmpi.b  #13,8(a4)
  955. X        bne     clic0
  956. X        tst.l   172(a4)
  957. X        beq     clic0
  958. X        move.l  140(a4),d3
  959. X        beq     clic0
  960. X        move.l  a4,d0
  961. X        move.l  d0,node
  962. X        bsr     hexa
  963. X        moveq   #0,d0
  964. X        move.b  9(a5),d0
  965. X        subq    #1,d0
  966. X        mulu    #10,d0
  967. X        move.l  #status,d1
  968. X        add.l   d1,d0
  969. X        bsr     putstr
  970. X        move.l  172(a4),a3
  971. X        adda.l  a3,a3
  972. X        adda.l  a3,a3
  973. X        move.l  #script,d0
  974. X        tst.l   40(a3)
  975. X        beq.s   clic5
  976. X        move.l  #interact,d0
  977. Xclic5        bsr     putstr
  978. X        move.l  #backg,d0
  979. X        tst.l   44(a3)
  980. X        bne.s   clic6
  981. X        move.l  #foreg,d0
  982. Xclic6        bsr     putstr
  983. X        bsr     bytedec
  984. X        move.l  4(a5),d0
  985. X        bsr     putstr
  986. X        moveq   #49,d1
  987. X        bsr     tab
  988. X        move.b  #' ',d0
  989. X        bsr     putchar
  990. X        move.l  128(a4),d0
  991. X        beq.s   noprogloadc
  992. Xclic3        move.l  172(a4),d1
  993. X        bne.s   clic4
  994. Xnoprogloadc move.l  #longnix,d0
  995. X        bsr     putnam
  996. X        bra.s   clic0
  997. Xclic4        lsl.l   #2,d1
  998. X        move.l  d1,a4
  999. X        move.l  60(a4),d1
  1000. X        beq.s   noprogloadc
  1001. X        move.l  16(a4),d0
  1002. X        bsr     putbcpl
  1003. X        bsr     newline
  1004. X
  1005. Xclic0        subq.b  #1,entries
  1006. X        bne     clic1
  1007. Xclic8        rts
  1008. X
  1009. X*--------- interrupts ------------
  1010. Xshowint     lea     iheader(PC),a0
  1011. X        bsr     puthead
  1012. X        lea     intnames(PC),a5
  1013. X        lea     inttyp(PC),a4
  1014. X        moveq   #0,d1
  1015. X        moveq   #15,d5
  1016. X        move.l  _SysBase(PC),a3
  1017. X        lea     84(a3),a3           ;SysBase->IntVects[16]
  1018. X
  1019. Xsi0        tst.b   0(a4,d1)
  1020. X        bne.s   si4
  1021. X        move.l  8(a3),a2            ;IntVector->iv_Node
  1022. X        bra.s   si5
  1023. Xsi4        move.l  0(a3),a2            ;Interrupt->is_Node
  1024. Xsi5        cmp.l   #0,a2
  1025. X        beq     nxtint
  1026. X        tst.b   0(a4,d1)
  1027. X        beq.s   si1
  1028. Xsi2        move.l  0(a2),a2            ;is_Node->ln_Next
  1029. X        tst.l   0(a2)
  1030. X        beq.s   nxtint
  1031. Xsi1        move.l  a2,d0
  1032. X        move.l  d0,node
  1033. X        bsr     hexa
  1034. X        move.l  14(a2),d0           ;Interrupt->is_Data
  1035. X        bsr     hexan
  1036. X        move.l  18(a2),d0           ;Interrupt->is_Code
  1037. X        bsr     hexan
  1038. X        move.b  9(a2),d3            ;Interrupt->ln_Pri
  1039. X        move.l  a3,-(a7)
  1040. X        bsr     plusmins
  1041. X        move.l  #intserv,d0
  1042. X        tst.b   0(a4,d1)
  1043. X        bne.s   1$
  1044. X        move.l  #inthand,d0
  1045. X1$        bsr     putstr
  1046. X        move.l  #intdis,d0
  1047. X        move.w  $dff01c,d3
  1048. X        btst.w  d1,d3
  1049. X        beq.s   2$
  1050. X        move.l  #inten,d0
  1051. X2$        bsr     putstr
  1052. X        move.l  (a7)+,a3
  1053. X        move.l  a5,d0
  1054. X        bsr     putstr
  1055. X        move.l  10(a2),d0           ;Interrupt->ln_Name
  1056. X        bsr     putnam
  1057. X        tst.b   0(a4,d1)
  1058. X        bne.s   si2
  1059. X        tst.l   0(a2)
  1060. X        beq.s   nxtint
  1061. X        move.l  0(a2),a2
  1062. X        bra     si1
  1063. Xnxtint        addq    #1,d1
  1064. X        lea     12(a5),a5
  1065. X        lea     12(a3),a3
  1066. X        dbf     d5,si0
  1067. X        rts
  1068. X
  1069. X*---------    resident ------------
  1070. X
  1071. Xshowresi    lea     rheader(PC),a0
  1072. X        bsr     puthead
  1073. X        move.l  _SysBase(PC),a5
  1074. X        move.l  300(a5),a5          ;SysBase->ResModules
  1075. X
  1076. Xr1        tst.l   0(a5)
  1077. X        beq     r2
  1078. X        move.l  0(a5),d0            ;Resident->ln_Next
  1079. X        tst.l   d0
  1080. X        bpl.s   r3
  1081. X        bclr    #31,d0
  1082. X        movea.l d0,a5
  1083. X        bra.s   r1
  1084. Xr3        movea.l d0,a4
  1085. X        move.l  d0,node
  1086. X        bsr     hexa
  1087. X        move.b  13(a4),d3           ;rt_Pri
  1088. X        bsr     plusmins
  1089. X        move.b  10(a4),d0           ;rt_Flags
  1090. X        bsr     bin
  1091. X        move.b  11(a4),d3           ;rt_Version
  1092. X        bsr     bytedec
  1093. X        move.b  12(a4),d0           ;rt_Type
  1094. X        bsr     gettype
  1095. X        move.l  14(a4),d0           ;rt_Name
  1096. X        bsr     putnam
  1097. Xr4        addq    #4,a5
  1098. X        bra     r1
  1099. Xr2        rts
  1100. X
  1101. X*---------  ports  -------------
  1102. X
  1103. Xshowprt     lea     pheader(PC),a0
  1104. X        bsr     puthead
  1105. X        move.l  _SysBase(PC),a4
  1106. X        lea     392(a4),a4          ;SysBase->PortList
  1107. X        lea     buffer,a5
  1108. X        moveq   #0,d5
  1109. X        CALL    Forbid,_SysBase(PC)
  1110. X        move.w  #$4000,$dff09a
  1111. Xsp2        move.l  0(a4),a4            ;mp_Node.ln_Next
  1112. X        tst.l   0(a4)
  1113. X        beq.s   sp20
  1114. X        bsr     getpdata
  1115. X        bra.s   sp2
  1116. Xsp20        tst.b   tports
  1117. X        bne.s   sp15
  1118. X        move.l  _SysBase(PC),a4
  1119. X        move.l  276(a4),a4          ;sysbase->ThisTask
  1120. X        lea     92(a4),a4           ;process->pr_MsgPort
  1121. X        bsr     getpdata
  1122. X        move.l  _SysBase(PC),a2
  1123. X        lea     406(a2),a2
  1124. Xsp11        move.l  0(a2),a2
  1125. X        tst.l   0(a2)
  1126. X        beq.s   sp14
  1127. X        lea     92(a2),a4
  1128. X        cmp.b   #13,8(a2)
  1129. X        bne.s   sp11
  1130. X        bsr     getpdata
  1131. X        bra     sp11
  1132. Xsp14        move.l  _SysBase(PC),a2
  1133. X        lea     420(a2),a2
  1134. Xsp12        move.l  0(a2),a2
  1135. X        tst.l   0(a2)
  1136. X        beq.s   sp15
  1137. X        lea     92(a2),a4
  1138. X        cmp.b   #13,8(a2)
  1139. X        bne.s   sp12
  1140. X        bsr     getpdata
  1141. X        bra     sp12
  1142. Xsp15        move.w  #-$4000,$dff09a
  1143. X        CALL    Permit,_SysBase(PC)
  1144. X        lea     buffer,a5
  1145. Xsp3        tst.b   d5
  1146. X        beq     sp6
  1147. X        move.l  0(a5),d0
  1148. X        move.l  d0,node
  1149. X        bsr     hexa
  1150. X        move.l  4(a5),d0
  1151. X        bsr     putstr
  1152. X        moveq   #25,d1
  1153. X        bsr     tab
  1154. X        move.b  8(a5),d0
  1155. X        and.l   #3,d0
  1156. X        mulu    #9,d0
  1157. X        add.l   #mp_flags,d0
  1158. X        bsr     putstr
  1159. X        move.b  9(a5),d3
  1160. X        bsr     bytedec
  1161. X        move.b  14(a5),d3
  1162. X        cmp.b   #255,d3
  1163. X        bne.s   1$
  1164. X        move.l  #toomuch,d0
  1165. X        bsr     putstr
  1166. X        bra.s   2$
  1167. X1$        bsr     bytedec
  1168. X2$        move.l  #longnix,d0
  1169. X        move.l  10(a5),d1
  1170. X        beq.s   sp8
  1171. X        move.l  d1,a3
  1172. X        move.l  10(a3),d0
  1173. Xsp8        bsr     putnam
  1174. X        lea     16(a5),a5
  1175. X        subq.b  #1,d5
  1176. X        bra     sp3
  1177. Xsp6        rts
  1178. X
  1179. Xgetpdata    move.l  a4,0(a5)
  1180. X        move.l  10(a4),4(a5)        ;ln_Name
  1181. X        move.b  14(a4),8(a5)        ;mp_Flags
  1182. X        move.b  15(a4),9(a5)        ;mp_SigBit
  1183. X        move.l  16(a4),10(a5)       ;mp_SigTask
  1184. X        moveq   #0,d0
  1185. X        movea.l 20(a4),a3           ;mp_MsgList
  1186. Xsp10        movea.l 0(a3),a3
  1187. X        cmpa.l  #0,a3
  1188. X        beq.s   sp9
  1189. X        addq.b  #1,d0
  1190. X        cmp.b   #255,d0
  1191. X        bne.s   sp10
  1192. Xsp9        move.b  d0,14(a5)
  1193. X        lea     16(a5),a5
  1194. X        addq.b  #1,d5
  1195. X        rts
  1196. X*-------- resources ------------
  1197. X
  1198. Xshowres     lea     lheader(PC),a0
  1199. X        bsr     puthead1
  1200. X        lea     resnam(PC),a0
  1201. X        bsr     puthead2
  1202. X        move.l  _SysBase(PC),d5
  1203. X        add.l   #336,d5        ;SysBase->ResourceList
  1204. X        bsr     show
  1205. X        rts
  1206. X
  1207. X*--------- devices  -------------
  1208. X
  1209. Xshowdevs    lea     lheader(PC),a0
  1210. X        bsr     puthead1
  1211. X        lea     devnam(PC),a0
  1212. X        bsr     puthead2
  1213. X        move.l  _SysBase(PC),d5
  1214. X        add.l   #350,d5        ;SysBase->DeviceList
  1215. X        bsr     show
  1216. X        rts
  1217. X
  1218. X*-------- libraries -------------
  1219. X
  1220. Xshowlibs    lea     lheader(PC),a0
  1221. X        bsr     puthead1
  1222. X        lea     libnam(PC),a0
  1223. X        bsr     puthead2
  1224. X        move.l  _SysBase(PC),d5
  1225. X        add.l   #378,d5        ;SysBase->LibList
  1226. X
  1227. Xshow        lea     buffer,a5
  1228. X        clr.b   entries
  1229. X        CALL    Forbid,_SysBase(PC)
  1230. X        move.l  d5,a4
  1231. Xsl1        move.l  0(a4),a4            ;lib_Node.ln_Next
  1232. X        tst.l   0(a4)
  1233. X        beq.s   sl2
  1234. X        addq.b  #1,entries
  1235. X        move.l  a4,0(a5)
  1236. X        move.l  10(a4),4(a5)        ;ln_Name
  1237. X        move.b  33(a4),8(a5)        ;lib_OpenCnt
  1238. X        move.b  21(a4),9(a5)        ;lib_Version
  1239. X        move.b  23(a4),10(a5)       ;lib_Revision
  1240. X        move.b  14(a4),11(a5)       ;lib_Flags
  1241. X        lea     12(a5),a5
  1242. X        bra.s   sl1
  1243. Xsl2        CALL    Permit,_SysBase(PC)
  1244. X
  1245. X        lea     buffer,a5
  1246. Xdl3        tst.b   entries
  1247. X        beq.s   sl4
  1248. X        move.l  0(a5),d0
  1249. X        move.l  d0,node
  1250. X        bsr     hexa
  1251. X        move.b  8(a5),d3
  1252. X        bsr     bytedec
  1253. X        move.b  9(a5),d3
  1254. X        bsr     bytedec
  1255. X        move.b  10(a5),d3
  1256. X        bsr     bytedec
  1257. X        move.b  11(a5),d0
  1258. X        bsr     bin
  1259. X        move.l  4(a5),d0
  1260. X        bsr     putnam
  1261. X        lea     12(a5),a5
  1262. X        subq.b  #1,entries
  1263. X        bra.s   dl3
  1264. Xsl4        rts
  1265. X
  1266. X;Remove a resident module from the list. Clears the rt_Matchword
  1267. X;to avoid being found and reinserted during the next reset
  1268. Xremresident bsr     nodenam2
  1269. X        cmp.b   #'$',0(a5)
  1270. X        bne.s   1$
  1271. X        move.l  a5,a0
  1272. X        bsr     readhex
  1273. X        tst.b   d7
  1274. X        bne.s   2$
  1275. X1$        move.l  a5,a1
  1276. X        CALL    FindResident,_SysBase(PC)
  1277. X        tst.l   d0
  1278. X        beq     fn5
  1279. X
  1280. X2$        move.l  _SysBase(PC),a3
  1281. X        move.l  300(a3),a3          ;SysBase->ResModules
  1282. X
  1283. X8$        move.l  (a3)+,d1
  1284. X        beq     fn5
  1285. X        bpl.s   3$
  1286. X        bclr    #31,d1
  1287. X        movea.l d1,a3
  1288. X        bra.s   8$
  1289. X3$        cmp.l   d1,d0
  1290. X        bne.s   8$
  1291. X
  1292. X4$        move.l  a3,a4
  1293. X5$        tst.l   (a4)+
  1294. X        bgt.s   5$
  1295. X
  1296. X6$        move.l  d0,a1
  1297. X        clr.w   0(a1)               ;rt_MatchTag
  1298. X        move.l  a4,d0
  1299. X        sub.l   a3,d0
  1300. X        lsr     #2,d0
  1301. X        subq    #1,d0
  1302. X        lea     -4(a3),a1
  1303. X7$        move.l  (a3)+,(a1)+
  1304. X        dbf     d0,7$
  1305. X        rts
  1306. X
  1307. X;find the first entry in the device-list
  1308. X;returns a1 = pointer to first entry
  1309. X
  1310. Xdevinfo     move.l  dosbase(PC),a1
  1311. X        move.l  34(a1),a1
  1312. X        move.l  24(a1),a1
  1313. X        adda.l  a1,a1
  1314. X        adda.l  a1,a1
  1315. X        move.l  4(a1),a1
  1316. X        rts
  1317. X
  1318. X;unlock a file
  1319. Xunlock        tst.b   fromfile
  1320. X        bne     ul6
  1321. X        bsr     readhex
  1322. X        tst.b   d7
  1323. X        beq     syntax
  1324. X        move.l  d0,remembr
  1325. X        move.l  d0,-(a7)
  1326. X        moveq   #-1,d6
  1327. X        bsr     of44
  1328. X        tst.l   remembr
  1329. X        beq.s   ul1
  1330. X        move.l  #unlerr,d0
  1331. X        bsr     putnam
  1332. X        bra     ul4
  1333. Xul1        bsr     ResumeOutput
  1334. X        move.l  #unl1,d0
  1335. X        bsr     putstr
  1336. X        move.l  0(a7),d0
  1337. X        bsr     getpath
  1338. X        move.l  #unltxt2,d0
  1339. X        bsr     putstr
  1340. X        bsr     readline
  1341. X        ori.b   #$20,inputbuffer
  1342. X        cmp.b   #'y',inputbuffer
  1343. X        bne.s   ul5
  1344. X        move.l  0(a7),d1
  1345. X        CALL    UnLock,dosbase
  1346. Xul5        bsr     freefinfo
  1347. Xul4        addq    #4,a7
  1348. Xul6        rts
  1349. X;---------- Show all Locks------------
  1350. Xlocks        moveq   #0,d6
  1351. X        bra.s   of33
  1352. X
  1353. X;---------- Open Files-----------
  1354. Xopenfiles   moveq   #1,d6
  1355. Xof33        move.l  mytask(PC),a4
  1356. X        move.l  184(a4),inputbuffer
  1357. X        move.l  #-1,184(a4)
  1358. X        lea     ofheader(PC),a0
  1359. X        bsr     puthead
  1360. Xof44        bsr     allocfinfo
  1361. X        bsr     devinfo
  1362. X        move.l  a1,a3
  1363. Xof1        adda.l  a3,a3
  1364. X        adda.l  a3,a3
  1365. X        cmp.l   #2,4(a3)
  1366. X        bne     of2
  1367. X        move.l  40(a3),d0
  1368. X        lsl.l   #2,d0
  1369. X        move.l  d0,a4
  1370. X        moveq   #0,d3
  1371. X        move.b  (a4)+,d3
  1372. X        subq    #1,d3
  1373. X        lea     buffer,a5
  1374. Xof22        move.b  (a4)+,(a5)+
  1375. X        dbf     d3,of22
  1376. X        move.b  #':',(a5)+
  1377. X        clr.b   0(a5)
  1378. X        cmp.l   #'RAM ',buffer
  1379. X        bne.s   of5
  1380. X        cmp.l   #'Disk',buffer+4
  1381. X        bne.s   of5
  1382. X        move.l  #$4d3a0000,buffer+2
  1383. Xof5        move.l  #buffer,d1
  1384. X        move.l  #-2,d2
  1385. X        CALL    Lock,dosbase(PC)
  1386. X        tst.l   d0
  1387. X        bne.s   of6
  1388. X        move.l  #buffer,d0
  1389. X        bsr     putstr
  1390. X        move.l  #nomount,d0
  1391. X        bsr     putnam
  1392. X        bra     of2
  1393. X
  1394. Xof6        move.l  d0,-(a7)
  1395. X        lsl.l   #2,d0
  1396. X        move.l  d0,a5
  1397. Xof4        move.l  0(a5),d0
  1398. X        cmp.l   #50,d0
  1399. X        ble     of3
  1400. X        move.l  d0,d5
  1401. X        lsl.l   #2,d5
  1402. X        move.l  d5,a5
  1403. X        move.l  d0,d5
  1404. X        tst     d6
  1405. X        bpl.s   of45
  1406. X
  1407. X        cmp.l   remembr(PC),d0
  1408. X        bne.s   of4
  1409. X        clr.l   remembr
  1410. X        move.l  (a7)+,d1
  1411. X        CALL    UnLock,dosbase(PC)
  1412. X        bra     quitof
  1413. X
  1414. Xof45        move.l  8(a5),d4
  1415. X        bsr     getfinfo
  1416. X        move.l  finfoptr,a4
  1417. X
  1418. X        tst.l   d6
  1419. X        beq.s   of8
  1420. X        bmi.s   of8
  1421. X        tst.l   4(a4)
  1422. X        bpl     of4
  1423. Xof8        move.l  d5,d0
  1424. X        move.l  d0,node
  1425. X        bsr     hexa
  1426. X        move.l  #access,d0
  1427. X        cmp     #-2,d4
  1428. X        beq.s   of7
  1429. X        addq    #8,d0
  1430. Xof7        bsr     putstr
  1431. X        tst.l   4(a4)
  1432. X        bmi.s   of9
  1433. X        move.l  #longnix,d0
  1434. X        bsr     putstr
  1435. X        bra     of10
  1436. Xof9        move.l  124(a4),d0
  1437. X        bsr     longdec
  1438. Xof10        move.l  d5,d0
  1439. X        bsr     getpath
  1440. X        bra     of4
  1441. X
  1442. X        bsr     newline
  1443. Xof3        move.l  (a7)+,d1
  1444. X        CALL    UnLock,dosbase(PC)
  1445. Xof2        move.l  0(a3),a3
  1446. X        cmpa.l  #0,a3
  1447. X        bne     of1
  1448. X        bsr     freefinfo
  1449. Xquitof        move.l  mytask(PC),a4
  1450. X        move.l  inputbuffer,184(a4)
  1451. X        rts
  1452. X
  1453. X;---------- Dos Devices ----------
  1454. X
  1455. Xdevices     lea     ddheader(PC),a0
  1456. X        bsr     puthead
  1457. X        bsr     devinfo
  1458. Xdev1        adda.l  a1,a1
  1459. X        adda.l  a1,a1
  1460. X        clr.b   d6
  1461. X        tst.l   4(a1)
  1462. X        bne     dev2
  1463. X        move.l  40(a1),d0
  1464. X        bsr     putbcpl
  1465. X        moveq   #10,d1
  1466. X        bsr     tab
  1467. X        cmp.l   #20,28(a1)
  1468. X        ble     dev9
  1469. X        moveq   #1,d6
  1470. X        move.l  28(a1),a3
  1471. X        adda.l  a3,a3
  1472. X        adda.l  a3,a3
  1473. X        cmp.l   #20,8(a3)
  1474. X        ble     dev9
  1475. X        move.l  8(a3),a2
  1476. X        adda.l  a2,a2
  1477. X        adda.l  a2,a2
  1478. X        move.l  12(a2),d3
  1479. X        movem.l a1-a3,-(a7)
  1480. X        bsr     bytedec
  1481. X        movem.l (a7)+,a1-a3
  1482. X        moveq   #1,d3
  1483. X        move.l  20(a2),d0
  1484. X        bsr     longdec
  1485. X        move.l  40(a2),d0
  1486. X        beq.s   devs20
  1487. X        addq    #1,d0
  1488. X        sub.l   36(a2),d0
  1489. Xdevs20        bsr     longdec
  1490. X        move.l  44(a2),d0
  1491. X        bsr     longdec
  1492. X        bra.s   dev8
  1493. Xdev9        move.l  #notfile,d0
  1494. X        bsr     putstr
  1495. Xdev8        tst.l   8(a1)
  1496. X        beq.s   dev6
  1497. X        move.l  #devload,d0
  1498. X        bra.s   dev5
  1499. Xdev6        move.l  #devnload,d0
  1500. Xdev5        bsr     putstr
  1501. X        tst.b   d6
  1502. X        beq.s   dev7
  1503. X        move.l  4(a3),d0
  1504. X        bne.s   dev4
  1505. Xdev7        move.l  16(a1),d0
  1506. X        bne.s   dev4
  1507. X        tst.l   8(a1)
  1508. X        beq.s   dev11
  1509. X        move.l  8(a1),a3
  1510. X        move.l  -82(a3),d0
  1511. X        bsr     putstr
  1512. X        bra     dev11
  1513. Xdev4        bsr     putbcpl
  1514. Xdev11        bsr     newline
  1515. Xdev2        move.l  0(a1),a1
  1516. X        cmpa.l  #0,a1
  1517. X        bne     dev1
  1518. X        rts
  1519. X
  1520. X; Check if a named dos-device is mounted
  1521. X; name in 'buffer'.
  1522. X; Result: d0 = 0(false) anything else(true).
  1523. X
  1524. Xfinddev     bsr     devinfo
  1525. Xfdev1        adda.l  a1,a1
  1526. X        adda.l  a1,a1
  1527. X        clr.b   d6
  1528. X        tst.l   4(a1)
  1529. X        bne.s   fdev2
  1530. X        move.l  40(a1),a2
  1531. X        lea     buffer,a0
  1532. X        bsr     strbcmp
  1533. X        tst     d0
  1534. X        bne.s   fdev3
  1535. Xfdev2        move.l  0(a1),a1
  1536. X        cmpa.l  #0,a1
  1537. X        bne.s   fdev1
  1538. Xfdev3        rts
  1539. X
  1540. X; Re-assign a drive to dos
  1541. X
  1542. Xfreedrive   clr.l   dp_Arg1
  1543. X        bra     ldr3
  1544. X
  1545. X; Inhibit a disk drive
  1546. X
  1547. Xlockdrive   move.l  #1,dp_Arg1
  1548. Xldr3        bsr     getstr
  1549. X        bsr     finddev
  1550. X        bne.s   ldr1
  1551. Xldr2        move.l  #buffer,d0
  1552. X        bsr     putstr
  1553. X        move.l  #nomount,d0
  1554. X        bsr     putstr
  1555. X        move.l  #dishelp,d0
  1556. X        bra     putnam
  1557. Xldr1        move.l  #buffer,d1
  1558. X        CALL    DeviceProc,dosbase(PC)
  1559. X        tst.l   d0
  1560. X        beq.s   ldr2
  1561. X        move.l  d0,a0
  1562. X        move.l  #31,dp_Type
  1563. X        bra     cons1
  1564. X
  1565. X;display the current directory of all processes,
  1566. X;except Workbench.(Worbench pr_CurrentDir is not a lock)
  1567. X
  1568. Xcurrentdir  lea     wbname(PC),a1
  1569. X        CALL    FindTask,_SysBase(PC)
  1570. X        move.l  d0,wbaddr
  1571. X        lea     cdheader(PC),a0
  1572. X        bsr     puthead
  1573. X        bsr     allocfinfo
  1574. X        moveq   #0,d5
  1575. X        bsr     getaskdat
  1576. X        lea     buffer,a5
  1577. Xcd2        tst.b   entries
  1578. X        beq.s   cd6
  1579. X        cmp.b   #13,8(a5)
  1580. X        bne.s   cd5
  1581. X        move.l  wbaddr(PC),d0
  1582. X        cmp.l   0(a5),d0
  1583. X        beq.s   cd5
  1584. X        move.l  4(a5),d0
  1585. X        bsr     putstr
  1586. X        moveq   #15,d1
  1587. X        bsr     tab
  1588. X        move.l  0(a5),a4
  1589. X        move.l  152(a4),d0
  1590. Xcd1        bsr     getpath
  1591. Xcd5        subq.b  #1,entries
  1592. X        lea     16(a5),a5
  1593. X        bra.s   cd2
  1594. Xcd6        bsr     freefinfo
  1595. X        rts
  1596. X
  1597. X;Change the current directory setting of a process
  1598. X
  1599. Xcd        tst.b   fromfile
  1600. X        bne     cd10
  1601. X        move.l  a0,-(a7)
  1602. X        lea     wbname(PC),a1
  1603. X        CALL    FindTask,_SysBase(PC)
  1604. X        move.l  d0,wbaddr
  1605. X        move.l  (a7)+,a0
  1606. X        bsr     getstr
  1607. X        move.l  a0,-(a7)
  1608. X        move.l  #buffer,d1
  1609. X        move.l  #-2,d2
  1610. X        CALL    Lock,dosbase(PC)
  1611. X        move.l  (a7)+,a0
  1612. X        tst.l   d0
  1613. X        bne     cd16
  1614. X        move.l  #dnotf,d0
  1615. X        bra     putnam
  1616. Xcd16        move.l  d0,remembr
  1617. X        move.l  a0,-(a7)
  1618. X        bsr     allocfinfo
  1619. X        move.l  remembr(PC),d0
  1620. X        bsr     getfinfo
  1621. X        move.l  finfoptr,a5
  1622. X        move.l  (a7)+,a0
  1623. X        tst.l   4(a5)
  1624. X        bpl.s   cd11
  1625. X        move.l  #notdir,d0
  1626. X        bsr     putnam
  1627. X        bra     cd18
  1628. Xcd11        bsr     nodenam
  1629. X        moveq.l #2,d7
  1630. X        lea     TRuNode(PC),a4
  1631. X        bsr     findnam
  1632. X        tst.b   d7
  1633. X        beq.s   cd15
  1634. X        move.l  d0,a5
  1635. X        cmp.b   #13,8(a5)
  1636. X        beq.s   cd15
  1637. X        bsr     syntax
  1638. X        bra     cd18
  1639. Xcd15        cmp.l   wbaddr,d0
  1640. X        bne.s   cd13
  1641. X        move.l  #wberr,d0
  1642. X        bsr     putnam
  1643. X        bra     cd12
  1644. Xcd13        move.l  152(a5),d1
  1645. X        move.l  remembr,152(a5)
  1646. X        move.l  d1,remembr
  1647. Xcd12        tst.l   remembr
  1648. X        beq.s   cd14
  1649. X        bsr     ResumeOutput
  1650. X        move.l  #unltxt,d0
  1651. X        bsr     putstr
  1652. X        move.l  remembr(PC),d0
  1653. X        bsr     getpath
  1654. X        move.l  #unltxt2,d0
  1655. X        bsr     putstr
  1656. X        bsr     readline
  1657. X        ori.b   #$20,inputbuffer
  1658. X        cmp.b   #'y',inputbuffer
  1659. X        bne.s   cd14
  1660. Xcd18        move.l  remembr(PC),d1
  1661. X        beq.s   cd14
  1662. X        CALL    UnLock,dosbase(PC)
  1663. Xcd14        bsr     freefinfo
  1664. Xcd10        rts
  1665. X
  1666. X;Display the list of inputhandlers. It adds a dummy
  1667. X;input handler, grabs the list header, and removes it
  1668. X
  1669. Xinphand     tst.b   background
  1670. X        bne.s   inph1
  1671. X        bsr     installh
  1672. Xinph1        move.l  #500,d4
  1673. X        lea     InInterrupt(PC),a0
  1674. Xinph2        tst.l   4(a0)
  1675. X        beq.s   inph3
  1676. X        move.l  4(a0),a0
  1677. X        dbf     d4,inph2
  1678. Xinph3        tst.b   background
  1679. X        bne.s   inph4
  1680. X        movem.l d4/a0,-(a7)
  1681. X        bsr     removeh
  1682. X        movem.l (a7)+,d4/a0
  1683. Xinph4        cmp.w   #-1,d4
  1684. X        bne.s   inph5
  1685. X        move.l  #failed,d0
  1686. X        bra     putnam
  1687. Xinph5        move.l  a0,-(a7)
  1688. X        lea     inheader(PC),a0
  1689. X        bsr     puthead
  1690. X        move.l  (a7)+,a5
  1691. Xinph6        move.l  0(a5),a5
  1692. X        tst.l   0(a5)
  1693. X        beq.s   inph7
  1694. X        move.l  a5,d0
  1695. X        move.l  d0,node
  1696. X        bsr     hexa
  1697. X        move.l  14(a5),d0
  1698. X        bsr     hexa
  1699. X        move.l  18(a5),d0
  1700. X        bsr     hexa
  1701. X        move.b  9(a5),d3
  1702. X        bsr     plusmins
  1703. X        move.l  10(a5),d0
  1704. Xinph8        bsr     putnam
  1705. X        bra.s   inph6
  1706. Xinph7        rts
  1707. X
  1708. X;get all screen pointers.
  1709. X;result: d5=number of screens
  1710. X;     buffer+100 holds pointers.
  1711. X
  1712. Xgetscr        lea     scrheader(PC),a0
  1713. X        bsr     puthead
  1714. Xgetscr2     move.l  intuibase(PC),a2
  1715. X        move.l  60(a2),a2
  1716. X        lea     buffer+100,a1
  1717. X        move.w  #$4000,$dff09a
  1718. X        moveq   #0,d5
  1719. Xsr1        move.l  a2,(a1)+
  1720. X        move.l  0(a2),a2
  1721. X        addq.l  #1,d5
  1722. X        cmpa.l  #0,a2
  1723. X        bne.s   sr1
  1724. X        subq    #1,d5
  1725. X        move.w  #-$4000,$dff09a
  1726. X        rts
  1727. X
  1728. X;display screen addresses and titles
  1729. X
  1730. Xscreens     bsr     getscr
  1731. X        moveq   #1,d6
  1732. X        lea     buffer+100,a1
  1733. Xsr2        move    d6,d3
  1734. X        bsr     bytedec
  1735. X        move.l  0(a1),d0
  1736. X        move.l  d0,node
  1737. X        bsr     hexa
  1738. X        move.l  (a1)+,a2
  1739. X        move.l  22(a2),d0
  1740. X        bsr     putnam
  1741. X        addq    #1,d6
  1742. X        dbf     d5,sr2
  1743. X        rts
  1744. X
  1745. X;display window addresses and titles
  1746. X
  1747. Xwindows     clr.b   bool
  1748. Xwindows1    bsr     getscr
  1749. X        tst.b   bool
  1750. X        beq.s   wn20
  1751. X        move.l  d5,-(a7)
  1752. X        lea     fohead(PC),a0
  1753. X        bsr     puthead
  1754. X        move.l  (a7)+,d5
  1755. Xwn20        lea     buffer+100,a4
  1756. Xwn2        move.l  #onscr,d0
  1757. X        bsr     putstr
  1758. X        move.l  (a4)+,a2
  1759. X        move.l  22(a2),d0
  1760. X        bsr     putnam
  1761. X        move.l  4(a2),a1
  1762. X        moveq   #0,d6
  1763. Xwn1        cmpa.l  #0,a1
  1764. X        beq.s   wn3
  1765. X        addq    #1,d6
  1766. X        move.l  d6,d3
  1767. X        bsr     bytedec
  1768. X        move.l  a1,d0
  1769. X        move.l  d0,node
  1770. X        bsr     hexa
  1771. X        move.l  32(a1),d0
  1772. X        bsr     putnam
  1773. X
  1774. X        tst.b   bool
  1775. X        beq.s   wn21
  1776. X        move.l  a1,-(a7)
  1777. X        move.l  50(a1),a1
  1778. X        move.l  52(a1),a1
  1779. X        bsr     fontdata
  1780. X        move.l  (a7)+,a1
  1781. X
  1782. Xwn21        move.l  0(a1),a1
  1783. X        bra.s   wn1
  1784. Xwn3        dbf     d5,wn2
  1785. X        rts
  1786. X
  1787. X;close a specified screen
  1788. X
  1789. Xclosescreen bsr     getscr2
  1790. X        moveq   #1,d6
  1791. X        cmp.b   #'$',0(a0)
  1792. X        bne.s   cs1
  1793. X        bsr     readhex
  1794. X        tst     d7
  1795. X        beq     syntax
  1796. X        move.l  d0,d4
  1797. Xcsin        moveq   #0,d6
  1798. Xcs1        lea     buffer+100,a2
  1799. Xcs5        tst     d6
  1800. X        bne.s   cs2
  1801. X        cmp.l   (a2)+,d4
  1802. X        beq.s   cs3
  1803. X        bra.s   cs4
  1804. Xcs2        move.l  (a2)+,a1
  1805. X        move.l  22(a1),a1
  1806. X        bsr     strcmp
  1807. X        tst     d0
  1808. X        beq.s   cs3
  1809. Xcs4        dbf     d5,cs5
  1810. X        move.l  #scnofound,d0
  1811. X        bra     putnam
  1812. Xcs3        move.l  -4(a2),a0
  1813. X        CALL    CloseScreen,intuibase(PC)
  1814. X        rts
  1815. X
  1816. X;close a specified window
  1817. Xclosewindow bsr     getwnptr
  1818. Xclw        move.l  a4,d0
  1819. X        beq.s   cwend
  1820. Xcw3        tst.l   36(a4)
  1821. X        beq.s   cw8
  1822. X        move.l  36(a4),a0
  1823. X        move.w  28(a0),d0
  1824. X        and.w   #$4000,d0
  1825. X        beq.s   cw9
  1826. X        move.l  a4,a0
  1827. X        CALL    FreeSysRequest,intuibase(PC)
  1828. X        rts
  1829. Xcw9        move.l  a4,a1
  1830. X        CALL    EndRequest,intuibase(PC)
  1831. X        bra.s   cw3
  1832. Xcw8        move.l  a4,a0
  1833. X        moveq   #0,d0
  1834. X        CALL    ModifyIDCMP,intuibase(PC)
  1835. X        move.l  a4,a0
  1836. X        CALL    CloseWindow,intuibase(PC)
  1837. Xcwend        rts
  1838. X
  1839. X
  1840. Xgetwnptr    bsr     getscr2
  1841. X        moveq   #1,d6
  1842. X        cmp.b   #'$',0(a0)
  1843. X        bne.s   cw1
  1844. X        bsr     readhex
  1845. X        tst     d7
  1846. X        bne.s   cwin
  1847. X        bsr     syntax
  1848. X        bra.s   cwerr
  1849. Xcwin        move.l  d0,d4
  1850. X        moveq   #0,d6
  1851. Xcw1        lea     buffer+100,a2
  1852. Xcw5        move.l  (a2)+,a4
  1853. X        move.l  4(a4),a4
  1854. Xcw6        cmpa.l  #0,a4
  1855. X        beq.s   cw4
  1856. X        tst     d6
  1857. X        bne.s   cw2
  1858. X        cmp.l   a4,d4
  1859. X        beq.s   cw10
  1860. X        bra.s   cw7
  1861. Xcw2        move.l  32(a4),a1
  1862. X        bsr     strcmp
  1863. X        tst     d0
  1864. X        beq.s   cw10
  1865. Xcw7        move.l  0(a4),a4
  1866. X        bra.s   cw6
  1867. Xcw4        dbf     d5,cw5
  1868. X        move.l  #winnofound,d0
  1869. X        bsr     putnam
  1870. Xcwerr        suba.l  a4,a4
  1871. Xcw10        rts
  1872. X
  1873. Xwindowoff   movem.l d1-d7/a0-a6,-(a7)
  1874. X        bsr     getscr2
  1875. X        bsr     cwin
  1876. X        move.l  a4,d1
  1877. X        beq.s   woff1
  1878. X        bsr     clw
  1879. X        move.l  -(a2),a0
  1880. X        move.l  a0,d4
  1881. X        tst.l   4(a0)
  1882. X        bne.s   woff1
  1883. X        bsr     getscr2
  1884. X        bsr     csin
  1885. Xwoff1        movem.l (a7)+,d1-d7/a0-a6
  1886. X        rts
  1887. X
  1888. Xclosetskwin movem.l d1-d7/a0-a6,-(a7)
  1889. Xctw0        bsr     getscr2
  1890. X        lea     buffer+100,a2
  1891. Xctw1        move.l  (a2)+,a4
  1892. X        move.l  4(a4),a4
  1893. Xctw6        cmpa.l  #0,a4
  1894. X        beq.s   ctw4
  1895. X        move.l  86(a4),a0
  1896. X        move.l  16(a0),d1
  1897. X        cmp.l   d0,d1
  1898. X        bne.s   ctw7
  1899. X        move.l  d0,d1
  1900. X        move.l  a4,d0
  1901. X        bsr     windowoff
  1902. X        move.l  d1,d0
  1903. X        bra     ctw0
  1904. Xctw7        move.l  0(a4),a4
  1905. X        bra.s   ctw6
  1906. Xctw4        dbf     d5,ctw1
  1907. X        movem.l (a7)+,d1-d7/a0-a6
  1908. X        rts
  1909. X
  1910. X;Change the font from a specified Window
  1911. X
  1912. Xsetfont     bsr     nodenam
  1913. X        tst.b   0(a5)
  1914. X        beq     syntax
  1915. X        move.l  a5,a4
  1916. X1$        cmp.b   #33,(a4)+
  1917. X        bge.s   1$
  1918. X        tst.b   -1(a4)
  1919. X        beq     syntax
  1920. X        clr.b   -1(a4)
  1921. X
  1922. X        lea     dummy,a0
  1923. X        move.l  a5,0(a0)
  1924. X        move.b  procnum(PC),d0
  1925. X        ext.w   d0
  1926. X        move.w  d0,4(a0)
  1927. X        clr.w   6(a0)
  1928. X        CALL    OpenFont,gfxbase(PC)
  1929. X        tst.l   d0
  1930. X        bne.s   2$
  1931. X        lea     diskfont(PC),a1
  1932. X        CALL    OpenLibrary,_SysBase(PC)
  1933. X        move.l  d0,d5
  1934. X        beq.s   4$
  1935. X        move.l  d0,a6
  1936. X        lea     dummy,a0
  1937. X        XREF    _LVOOpenDiskFont
  1938. X        jsr     _LVOOpenDiskFont(a6)
  1939. X        move.l  d0,d4
  1940. X        move.l  d5,a1
  1941. X        CALL    CloseLibrary,_SysBase(PC)
  1942. X        move.l  d4,d0
  1943. X        bne.s   2$
  1944. X4$        move.l  #fonterr,d0
  1945. X        bsr     putstr
  1946. X        move.l  dummy,d0
  1947. X        bra     putnam
  1948. X2$        move.l  d0,-(a7)
  1949. X        move.l  a4,a0
  1950. X        bsr     kllblnks
  1951. X        bsr     getwnptr
  1952. X        move.l  (a7)+,a0
  1953. X        move.l  a4,d1
  1954. X        bne.s   5$
  1955. X        move.l  a0,a1
  1956. X        CALL    CloseFont,gfxbase(PC)
  1957. X        bra.s   3$
  1958. X5$        move.l  50(a4),a1
  1959. X        CALL    SetFont,gfxbase(PC)
  1960. X        move.l  a4,a0
  1961. X        CALL    RefreshWindowFrame,intuibase(PC)
  1962. X3$        rts
  1963. X
  1964. X
  1965. X;display windows and associated fonts
  1966. X
  1967. Xwindowfonts move.b  #1,bool
  1968. X        bra     windows1
  1969. X
  1970. X;display loaded font names and definitions
  1971. X
  1972. Xfonts        lea     fohead(PC),a0
  1973. X        bsr     puthead
  1974. X        move.l  gfxbase(PC),a1
  1975. X        move.l  $8c(a1),a1
  1976. Xfo1        tst.l   0(a1)
  1977. X        beq.s   fo3
  1978. X        bsr     fontdata
  1979. X        move.l  0(a1),a1
  1980. X        bra     fo1
  1981. Xfo3        rts
  1982. X
  1983. Xfontdata    move.l  a1,d0
  1984. X        move.l  d0,node
  1985. X        bsr     hexa
  1986. X        move.w  30(a1),d3
  1987. X        bsr     bytedec
  1988. X        move.w  20(a1),d3
  1989. X        bsr     bytedec
  1990. X        move.w  24(a1),d3
  1991. X        bsr     bytedec
  1992. X        move.l  #romfnt,d0
  1993. X        btst    #1,23(a1)
  1994. X        beq.s   fod1
  1995. X        move.l  #diskfnt,d0
  1996. Xfod1        bsr     putstr
  1997. X        move.b  32(a1),d3
  1998. X        bsr     bytedec
  1999. X        move.b  33(a1),d3
  2000. X        bsr     bytedec
  2001. X        move.l  10(a1),d0
  2002. X        bra     putnam
  2003. X
  2004. X;set update rate
  2005. X
  2006. Xsettime     bsr     getnum
  2007. X        tst.b   d7
  2008. X        bne.s   st1
  2009. X        move.b  timeout(PC),d3
  2010. X        bne.s   1$
  2011. X        move.l  #timenotset,d0
  2012. X        bra.s   sy1
  2013. X1$        move.l  #whattime,d0
  2014. X        bsr     putstr
  2015. X        bsr     bytedec
  2016. X        bra     newline
  2017. Xst1        move.b  d2,timeout
  2018. X        rts
  2019. Xsyntax        move.l  #synerr,d0
  2020. Xsy1        bra     putnam
  2021. X
  2022. X;copy a string from input to 'buffer'
  2023. X;a0 = pointer to string
  2024. X
  2025. Xgetstr        lea     buffer,a5
  2026. Xgst2        cmp.b   #' ',0(a0)
  2027. X        beq.s   gst1
  2028. X        cmp.b   #10,0(a0)
  2029. X        beq.s   gst1
  2030. X        move.b  (a0)+,(a5)+
  2031. X        bra.s   gst2
  2032. Xgst1        clr.b   0(a5)
  2033. X        bra     kllblnks
  2034. X
  2035. X;read in a nodename or a processname
  2036. X
  2037. Xnodenam     bsr     isdec
  2038. X        move.b  d2,procnum
  2039. Xnodenam2    bsr     kllblnks
  2040. X        move.l  a0,a5
  2041. Xgno1        cmp.b   #10,(a0)+
  2042. X        bne.s   gno1
  2043. X        move.b  #0,-1(a0)
  2044. X        rts
  2045. X
  2046. X;modify a task's priority
  2047. X
  2048. Xtaskpri     bsr     getnum
  2049. X        tst.b   d7
  2050. X        beq     syntax
  2051. X        move.b  d2,newpri
  2052. X        bsr     nodenam
  2053. X        moveq.l #2,d7
  2054. X        lea     TRuNode(PC),a4
  2055. X        bsr     findnam
  2056. X        tst.b   d7
  2057. X        beq.s   tp1
  2058. X        move.l  d0,a1
  2059. X        move.b  newpri,d0
  2060. X        CALL    SetTaskPri,_SysBase(PC)
  2061. Xtp1        rts
  2062. X
  2063. X;set the priority of our task
  2064. X
  2065. Xmypri        bsr     getnum
  2066. X        tst.b   d7
  2067. X        beq     syntax
  2068. X        move.l  _SysBase(PC),a1
  2069. X        move.l  276(a1),a1
  2070. X        move.l  d2,d0
  2071. X        CALL    SetTaskPri,_SysBase(PC)
  2072. X        rts
  2073. X
  2074. X;cancel a task or a process. The theory is quite simple:
  2075. X;(Process->ReturnAddr)-4 points to the return address on
  2076. X;the stack. Task->SPReg points to the next instruction
  2077. X;to be executed. We just need a
  2078. X; *(Task->SPReg) = *(Process->ReturnAddr-4).
  2079. X;If the process has been started from Dos (CLI) and
  2080. X;the process is doing disk I/O, the CLI will respond with
  2081. X;a GURU #87000004 (AsyncPKT=unexpected packed received).
  2082. X;Thats why the calling CLI is also canceled.
  2083. X
  2084. X
  2085. Xcancel        tst.b   fromfile
  2086. X        beq.s   cancel1
  2087. X        rts
  2088. Xcancel1     clr.l   remembr        ;used for CLI stdio
  2089. X        clr.l   remembr2
  2090. X        clr.b   bool
  2091. X        bsr     nodenam
  2092. Xtestagain   moveq.l #1,d7
  2093. X        lea     TReNode(PC),a4
  2094. X        bsr     findnam
  2095. X        tst.b   d7
  2096. X        bne.s   canok
  2097. Xcnerr        move.l  #stperr,d0
  2098. X        bra     putnam
  2099. X
  2100. Xcanok        move.l  d0,a1       ;d0=task
  2101. X        move.l  d0,pointer
  2102. X        cmp.b   #1,8(a1)       ;TASK ?
  2103. X        bne.s   isproc
  2104. X        CALL    RemTask,_SysBase(PC)
  2105. X        move.l  pointer(PC),d0
  2106. X        bra     closetskwin
  2107. X
  2108. Xisproc        movem.l d0-d7/a0-a6,-(a7)
  2109. X        move.l  #-1,d0          ;needed for recursive killing tasks
  2110. X        CALL    AllocSignal,_SysBase(PC)
  2111. X        moveq   #0,d1
  2112. X        bset    d0,d1
  2113. X        move.l  d1,cancelbit
  2114. X        move.l  d0,cancelbnum
  2115. X        movem.l (a7)+,d0-d7/a0-a6
  2116. X
  2117. X        moveq   #0,d5
  2118. X        tst.l   $ac(a1)         ;pr_CLI
  2119. X        beq.s   wascreproc
  2120. X        move.l  $80(a1),a2      ;Seglist
  2121. X        adda.l  a2,a2
  2122. X        adda.l  a2,a2
  2123. X        move.l  12(a2),d1       ;empty ?
  2124. X        bne.s   wascreproc
  2125. X        move.l  $ac(a1),a2      ;CommandLineInterface
  2126. X        adda.l  a2,a2
  2127. X        adda.l  a2,a2
  2128. X        move.l  60(a2),d5       ;cli_Module
  2129. X        tst.l   40(a2)          ;IsInteractive
  2130. X        beq     dosreturn
  2131. X        move.l  28(a2),remembr  ;yes,get Cli-Window locks
  2132. X        move.l  56(a2),remembr2
  2133. X        bra     dosreturn
  2134. Xwascreproc  tst.b   bool        ;it is not a CLI, ask what to do
  2135. X        bne     unload
  2136. X        move.b  #3,bool
  2137. X        bsr     ResumeOutput
  2138. X        move.l  #canerr0,d0     ;ask for Workbench
  2139. X        bsr     putstr
  2140. X        bsr     readline
  2141. X        cmp.b   #'y',inputbuffer
  2142. X        beq.s   andagain
  2143. X        move.b  #2,bool
  2144. X        bsr     ResumeOutput
  2145. X        move.l  #canerr1,d0    ;ask for unload
  2146. X        bsr     putstr
  2147. X        bsr     readline
  2148. X        cmp.b   #'y',inputbuffer
  2149. X        bne.s   andagain
  2150. X        move.b  #1,bool
  2151. Xandagain    move.l  pointer(PC),d0
  2152. X        moveq.l #1,d7
  2153. X        lea     TReNode(PC),a4
  2154. X        bsr     tstnode
  2155. X        tst     d5
  2156. X        beq     cnerr
  2157. X        bra     canok
  2158. X
  2159. Xunload        move.l  128(a1),d4 ;get Segmentlist
  2160. X        beq.s   unl3
  2161. X        lsl.l   #2,d4
  2162. X        move.l  d4,a3
  2163. X        move.l  12(a3),d4
  2164. Xunl3        tst.l   d4
  2165. X        bne.s   unl4
  2166. X        move.l  #unloaderr,d0 ;no Segments !?
  2167. X        bra     putnam
  2168. X
  2169. Xunl4        cmp.b   #3,bool           ;Workbench Task
  2170. X        bne.s   unl2
  2171. X        move.l  a1,-(a7)
  2172. X        moveq   #40,d0           ;build a copy of the
  2173. X        move.l  #$10000,d1           ;Workbench startup-message
  2174. X        CALL    AllocMem,_SysBase(PC)
  2175. X        move.l  d0,startmess
  2176. X        move.l  (a7)+,a1
  2177. X        move.l  d0,a0
  2178. X        move.b  #5,8(a0)
  2179. X        move.w  #20,18(a0)
  2180. X        move.l  d4,24(a0)
  2181. X        move.l  a1,d0
  2182. X        add.l   #92,d0
  2183. X        move.l  d0,20(a0)
  2184. X        movem.l a0-a1,-(a7)
  2185. X        lea     wbname(PC),a1
  2186. X        CALL    FindPort,_SysBase(PC)
  2187. X        movem.l (a7)+,a0-a1
  2188. X        move.l  d0,14(a0)
  2189. X
  2190. Xunl2        cmp.b   #1,bool
  2191. X        bne.s   dosreturn
  2192. X        move.l  a1,-(a7)           ;unload process manualy
  2193. X        move.l  d4,d1
  2194. X        CALL    UnLoadSeg,dosbase(PC)
  2195. X        move.l  (a7)+,a1
  2196. X
  2197. Xdosreturn   move.l  140(a1),savedat ;Processnumber
  2198. Xdosret1     move.w  #$4000,$dff09a
  2199. X        move.l  54(a1),a3
  2200. X        move.l  #endtask,0(a3)
  2201. X        move.l  #2,106(a1)
  2202. X        move.l  mytask(PC),108(a1)
  2203. X        cmp.b   #4,15(a1)        ;if waiting
  2204. X        bne.s   doswait
  2205. X        move.l  a1,d4
  2206. X        CALL    Remove,_SysBase(PC)
  2207. X        move.l  d4,a1
  2208. X        lea     406(a6),a0       ; activate the task
  2209. X        CALL    AddHead,_SysBase(PC)
  2210. X        move.l  d4,a1
  2211. Xdoswait     move.w  #-$4000,$dff09a
  2212. X        tst.b   bool
  2213. X        bne.s   endnodos
  2214. X        tst.l   d5
  2215. X        beq     endcanc
  2216. X        move.l  $ac(a1),a2
  2217. X        adda.l  a2,a2
  2218. X        adda.l  a2,a2
  2219. Xdwa1        movem.l d0-d7/a0-a6,-(a7)
  2220. X        move.l  cancelbit(PC),d0
  2221. X        CALL    Wait,_SysBase(PC)
  2222. X        movem.l (a7)+,d0-d7/a0-a6
  2223. X        moveq   #0,d5
  2224. X        bra     dosret1
  2225. X
  2226. Xendcanc     move.l  a1,-(a7)
  2227. X        move.l  remembr(PC),d1    ;close CLI-Window
  2228. X        beq.s   ecan1          ;if any
  2229. X        CALL    Close,dosbase(PC)
  2230. Xecan1        move.l  remembr2(PC),d1
  2231. X        beq.s   ecan2
  2232. X        CALL    Close,dosbase(PC)
  2233. Xecan2        move.l  (a7)+,a1
  2234. X
  2235. X        move.l  savedat(PC),d0   ;remove Task from
  2236. X        move.l  dosbase(PC),a2   ;TaskArray
  2237. X        move.l  34(a2),a2
  2238. X        move.l  0(a2),a2
  2239. X        adda.l  a2,a2
  2240. X        adda.l  a2,a2
  2241. X        lsl.l   #2,d0
  2242. X        clr.l   0(a2,d0)
  2243. X
  2244. Xendnodos    move.l  a1,d0
  2245. X        bsr     closetskwin
  2246. X        move.l  cancelbnum(PC),d0      ;remove our Signal
  2247. X        CALL    FreeSignal,_SysBase(PC)
  2248. X        rts
  2249. X
  2250. X;This Code is (hopefully) excuted by the Process we want
  2251. X;to kill
  2252. X
  2253. Xendtask     CALL    Forbid,_SysBase(PC)
  2254. X        CALL    Disable,_SysBase(PC)
  2255. X        move.l  _SysBase(PC),a1
  2256. X        move.l  276(a1),a1
  2257. X        move.l  176(a1),a1          ;Process_ReturnAddr
  2258. X        lea     -4(a1),a7           ;reset Process Stackptr
  2259. X        tst.b   bool
  2260. X        bne.s   et0
  2261. X        movea.l mytask(PC),a1
  2262. X        move.l  cancelbit(PC),d0    ;signal Xoper it
  2263. X        CALL    Signal,_SysBase(PC) ;died
  2264. Xet0        cmp.b   #3,bool        ;Workbench Process ?
  2265. X        bne.s   et1
  2266. X        move.l  startmess(PC),a1
  2267. X        CALL    ReplyMsg,_SysBase(PC) ;reply startup message
  2268. Xet1        rts
  2269. X
  2270. X;Stop a task (just queue it on a special list)
  2271. X
  2272. Xfreeze        bsr     nodenam
  2273. X        moveq.l #1,d7
  2274. X        lea     TReNode(PC),a4
  2275. X        bsr     findnam
  2276. X        tst.b   d7
  2277. X        bne.s   frok
  2278. X        move.l  #stperr,d0
  2279. X        bra     putstr
  2280. Xfrok        move.w  #$4000,$dff09a
  2281. X        move.l  d0,a1
  2282. X        CALL    Remove,_SysBase(PC)
  2283. X        move.w  #-$4000,$dff09a
  2284. X        move.l  d0,a1
  2285. X        move.l  d0,a5
  2286. X        lea     stplist(PC),a0
  2287. X        CALL    AddHead,_SysBase(PC)
  2288. X        add.b   #4,15(a5)
  2289. X        rts
  2290. X;put the task back on its list
  2291. Xwarm        bsr     nodenam
  2292. X        cmp.b   #'$',0(a5)
  2293. X        bne.s   1$
  2294. X        move.l  d7,d2
  2295. X        move.l  a5,a0
  2296. X        bsr     readhex
  2297. X        tst.b   d7
  2298. X        beq.s   1$
  2299. X        move.l  stplist(PC),a3
  2300. X3$        tst.l   0(a3)
  2301. X        beq.s   2$
  2302. X        cmp.l   a3,d0
  2303. X        beq.s   waok
  2304. X        move.l  0(a3),a3
  2305. X        bra.s   3$
  2306. X1$        lea     stplist(PC),a0
  2307. X        movea.l a5,a1
  2308. X        moveq   #0,d7
  2309. X        bsr     fn4
  2310. X        tst.b   d7
  2311. X        bne.s   waok
  2312. X2$        move.l  #waerr,d0
  2313. X        bra     putstr
  2314. Xwaok        move.w  #$4000,$dff09a
  2315. X        move.l  d0,a1
  2316. X        CALL    Remove,_SysBase(PC)
  2317. X        move.l  d0,a1
  2318. X        move.l  d0,a5
  2319. X        move.l  TReNode,a0
  2320. X        cmp.b   #8,15(a1)
  2321. X        bne.s   wa1
  2322. X        move.l  TWaNode,a0
  2323. Xwa1        adda.l  _SysBase(PC),a0
  2324. X        CALL    AddTail,_SysBase(PC)
  2325. X        move.l  d0,a1
  2326. X        subq.b  #4,15(a5)
  2327. X        move.w  #-$4000,$dff09a
  2328. X        move.l  18(a5),d0
  2329. X        and.l   26(a5),d0
  2330. X        beq.s   wa2
  2331. X        movea.l a5,a1
  2332. X        CALL    Signal,_SysBase(PC)
  2333. Xwa2        rts
  2334. X;show the hunks of a process
  2335. Xhunks        bsr     nodenam
  2336. X        moveq.l #2,d7
  2337. X        lea     TRuNode(PC),a4
  2338. X        bsr     findnam
  2339. X        tst.b   d7
  2340. X        bne.s   hu1
  2341. X        rts
  2342. Xhu1        move.l  d0,a4
  2343. X        cmp.b   #13,8(a4)
  2344. X        beq.s   hu2
  2345. X        move.l  #noprocs,d0
  2346. X        bra     putnam
  2347. Xhu2        move.l  128(a4),d0
  2348. X        beq.s   noprogload
  2349. X        lsl.l   #2,d0
  2350. X        move.l  d0,a3
  2351. X        move.l  12(a3),d1
  2352. X        beq.s   hu3
  2353. X        move.l  #segloaded,d0
  2354. X        bsr     putnam
  2355. X        bra     hu5
  2356. Xhu3        move.l  172(a4),d1
  2357. X        bne.s   hu4
  2358. Xnoprogload  move.l  #notload,d0
  2359. X        bra     putnam
  2360. Xhu4        move.l  #cliprocs,d0
  2361. X        bsr     putnam
  2362. X        lsl.l   #2,d1
  2363. X        move.l  d1,a4
  2364. X        move.l  60(a4),d1
  2365. X        beq.s   noprogload
  2366. X        move.l  #procloaded,d0
  2367. X        bsr     putstr
  2368. X        move.l  16(a4),d0
  2369. X        bsr     putbcpl
  2370. X        bsr     newline
  2371. Xhu5        lea     hunkheader(PC),a0
  2372. X        bsr     puthead
  2373. X        moveq   #0,d5
  2374. Xhu6        move.l  d5,d3
  2375. X        bsr     bytedec
  2376. X        addq    #1,d5
  2377. X        move.l  d1,d0
  2378. X        bsr     hexa
  2379. X        lsl.l   #2,d1
  2380. X        move.l  d1,a4
  2381. X        move.l  d1,d0
  2382. X        addq.l  #4,d0
  2383. X        bsr     hexa
  2384. X        move.l  -4(a4),d0
  2385. X        bsr     hexa
  2386. X        bsr     newline
  2387. X        move.l  0(a4),d1
  2388. X        bne.s   hu6
  2389. X        rts
  2390. X;change the priority of a node
  2391. Xpri        bsr     getnum
  2392. X        tst.b   d7
  2393. X        beq     syntax
  2394. X        move.b  d2,newpri
  2395. X        bsr     nodenam2
  2396. X        moveq.l #5,d7
  2397. X        lea     DevNode(PC),a4
  2398. X        bsr     findnam
  2399. X        tst.b   d7
  2400. X        beq.s   pi1
  2401. X        move.l  d0,a1
  2402. X        move.b  newpri,9(a1)
  2403. X        cmp.l   #SemNode,a4
  2404. X        ble.s   pi2
  2405. X        move.l  #listerr,d0
  2406. X        bra     putnam
  2407. Xpi2        CALL    Forbid,_SysBase(PC)
  2408. X        CALL    Remove,_SysBase(PC)
  2409. X        move.l  d0,a1
  2410. X        move.l  a4,a0
  2411. X        move.l  0(a0),d6
  2412. X        lea     0(a6,d6),a0
  2413. X        CALL    Enqueue,_SysBase(PC)
  2414. X        CALL    Permit,_SysBase(PC)
  2415. Xpi1        rts
  2416. X;set all break signals of a task
  2417. Xbreak        move.l  #$f000,d0
  2418. X        bra     setthem
  2419. X
  2420. Xsignal        bsr     readhex
  2421. X        tst.b   d7
  2422. X        beq     syntax
  2423. Xsetthem     move.l  d0,savedat
  2424. X        bsr     nodenam
  2425. X        moveq.l #2,d7
  2426. X        lea     TReNode(PC),a4
  2427. X        bsr     findnam
  2428. X        tst.b   d7
  2429. X        beq.s   pi1
  2430. X        move.l  d0,a1
  2431. X        move.l  savedat,d0
  2432. X        and.l   18(a1),d0
  2433. X        CALL    Signal,_SysBase(PC)
  2434. X        rts
  2435. X
  2436. X;set up a list of tasknames which should't be displayed
  2437. X
  2438. Xhide        cmp.b   #10,0(a0)
  2439. X        bne.s   hid5
  2440. X        bra     syntax
  2441. Xhid5        lea     hidestart(PC),a2
  2442. X        move.l  a2,d3
  2443. Xhid0        tst.l   0(a2)
  2444. X        beq.s   hid1
  2445. X        move.l  0(a2),a2
  2446. X        lea     4(a2),a1
  2447. X        bsr     strcmp
  2448. X        tst     d0
  2449. X        beq.s   hid2
  2450. X        move.l  a2,d3
  2451. X        bra.s   hid0
  2452. Xhid1        move.l  a0,a4
  2453. X        bsr     strlen2
  2454. X        addq    #5,d0
  2455. X        move.l  #65536,d1
  2456. X        CALL    AllocMem,_SysBase(PC)
  2457. X        tst.l   d0
  2458. X        beq.s   hid4
  2459. X        move.l  d0,a1
  2460. X        move.l  d0,0(a2)
  2461. X        addq    #4,a1
  2462. Xhid3        cmp.b   #10,0(a4)
  2463. X        beq.s   hid4
  2464. X        move.b  (a4)+,(a1)+
  2465. X        bra.s   hid3
  2466. Xhid4        rts
  2467. Xhid2        move.l  d3,a3
  2468. X        move.l  0(a2),0(a3)
  2469. Xfreehidden  lea     4(a2),a0
  2470. X        bsr     strlen
  2471. X        addq    #5,d0
  2472. X        move.l  a2,a1
  2473. X        CALL    FreeMem,_SysBase(PC)
  2474. X        rts
  2475. X
  2476. Xfreehidmem  move.l  hidestart(PC),a4
  2477. Xfhm0        move.l  a4,d0
  2478. X        beq.s   fhm1
  2479. X        move.l  a4,a2
  2480. X        move.l  0(a2),a4
  2481. X        bsr     freehidden
  2482. X        bra     fhm0
  2483. Xfhm1        rts
  2484. X
  2485. X;set up an ALIAS list
  2486. Xalias        cmp.b   #10,0(a0)
  2487. X        beq     showalias
  2488. X        bsr     strbuf
  2489. X        move.l  a0,a5
  2490. X        lea     buffer,a0
  2491. X        bsr     strlen
  2492. X        tst.l   d0
  2493. X        beq     syntax
  2494. X
  2495. X        moveq   #1,d1
  2496. X        cmp     d1,d0
  2497. X        bne.s   5$
  2498. X        lea     params(PC),a0
  2499. X        moveq   #parmnum-1,d1
  2500. X        move.b  buffer,d2
  2501. X6$        cmp.b   (a0)+,d2
  2502. X        dbeq    d1,6$
  2503. X        tst.w   d1
  2504. X        bmi.s   5$
  2505. X        move.l  #aliaserr,d0
  2506. X        bsr     putstr
  2507. X        move.l  #params,d0
  2508. X        bsr     putstr
  2509. X        move.l  #aliaserr2,d0
  2510. X        bra     putnam
  2511. X
  2512. X5$        move.l  d0,d5
  2513. X        move.l  a5,a0
  2514. X        adda.l  d0,a0
  2515. X        bsr     kllblnks
  2516. X        move.l  a5,-(a7)
  2517. X        bsr     findcmd
  2518. X        move.l  (a7)+,a5
  2519. X        tst.l   d2
  2520. X        bmi     syntax
  2521. X        move.l  a5,a0
  2522. X        bsr     strbuf
  2523. X
  2524. X        addq    #6,d5
  2525. X        move.l  d5,d0
  2526. X        move.l  #65536,d1
  2527. X        CALL    AllocMem,_SysBase(PC)
  2528. X        tst.l   d0
  2529. X        beq.s   1$
  2530. X
  2531. X        move.l  aliaslist(PC),d1
  2532. X        bne.s   2$
  2533. X        move.l  d0,aliaslist
  2534. X        bra.s   3$
  2535. X2$        move.l  d1,a0
  2536. X        move.l  0(a0),d1
  2537. X        bne.s   2$
  2538. X        move.l  d0,0(a0)
  2539. X
  2540. X3$        move.l  d0,a0
  2541. X        move.b  d2,4(a0)
  2542. X
  2543. X        lea     5(a0),a0
  2544. X        lea     buffer,a1
  2545. X4$        move.b  (a1)+,(a0)+
  2546. X        bne.s   4$
  2547. X1$        rts
  2548. X
  2549. Xshowalias   lea     alhead(PC),a0
  2550. X        bsr     puthead
  2551. X        move.l  aliaslist(PC),d0
  2552. X        beq.s   1$
  2553. X2$        move.l  d0,a5
  2554. X        addq    #5,d0
  2555. X        bsr     putstr
  2556. X        move.w  #15,d1
  2557. X        bsr     tab
  2558. X        move.l  #equal,d0
  2559. X        bsr     putstr
  2560. X        move.b  4(a5),d0
  2561. X        ext.w   d0
  2562. X        bsr     getcmdptr
  2563. X        bsr     putnam
  2564. X        move.l  0(a5),d0
  2565. X        bne.s   2$
  2566. X1$        rts
  2567. X
  2568. Xfreealias   move.l  aliaslist(PC),a4
  2569. X1$        move.l  a4,d0
  2570. X        beq.s   2$
  2571. X        move.l  a4,a2
  2572. X        move.l  0(a2),a4
  2573. X        lea     5(a2),a0
  2574. X        bsr     strlen
  2575. X        addq    #6,d0
  2576. X        move.l  a2,a1
  2577. X        CALL    FreeMem,_SysBase(PC)
  2578. X        bra     1$
  2579. X2$        rts
  2580. X
  2581. Xgetcmdptr   move.l  a0,-(a7)
  2582. X        lea     commds(PC),a0
  2583. X2$        tst     d0
  2584. X        beq.s   1$
  2585. X3$        tst.b   (a0)+
  2586. X        bne.s   3$
  2587. X        subq    #1,d0
  2588. X        bra.s   2$
  2589. X1$        move.l  a0,d0
  2590. X        move.l  (a7)+,a0
  2591. X        rts
  2592. X
  2593. X
  2594. X;'flushlibs'
  2595. Xflush        move.l  #$ffffff,d0
  2596. X        moveq   #0,d1
  2597. X        CALL    AllocMem,_SysBase(PC)
  2598. Xflsh1        rts
  2599. X
  2600. X;display library->lib_IDString
  2601. Xinfo        bsr     nodenam2
  2602. X        moveq.l #2,d7
  2603. X        lea     DevNode(PC),a4
  2604. X        bsr     findnam
  2605. X        tst.b   d7
  2606. X        beq.s   flsh1
  2607. X        move.l  d0,a0
  2608. X        move.l  24(a0),d0
  2609. X        beq.s   if1
  2610. X        move.l  d0,d1
  2611. X        andi.l  #1,d1
  2612. X        bne.s   if1
  2613. X        bra     putnam
  2614. Xif1        move.l  #noinfo,d0
  2615. X        bsr     putstr
  2616. X        move.l  a5,d0
  2617. X        bra     putnam
  2618. X
  2619. Xcapture     move.l  _SysBase(PC),a1
  2620. X        lea     42(a1),a0
  2621. X        moveq   #2,d6
  2622. X        lea     coldtxt,a4
  2623. Xcap0        move.l  a4,d0
  2624. X        bsr     putstr
  2625. X        move.l  0(a0),d0
  2626. X        bne.s   cap1
  2627. X        move.l  #unset,d0
  2628. X        bsr     putstr
  2629. X        bra     cap2
  2630. Xcap1        bsr     hexa
  2631. Xcap2        bsr     newline
  2632. X        lea     15(a4),a4
  2633. X        addq    #4,a0
  2634. X        dbf     d6,cap0
  2635. X
  2636. X        move.l  #kicktxt,d0
  2637. X        bsr     putstr
  2638. X        move.l  546(a1),a0
  2639. X        cmpa.l  #0,a0
  2640. X        bne.s   kickm3
  2641. X        move.l  #unset,d0
  2642. X        bra     putnam
  2643. Xkickm3        move.l  a0,-(a7)
  2644. X        bsr     newline
  2645. X        lea     kickhead(PC),a0
  2646. X        bsr     puthead
  2647. X        move.l  (a7)+,a0
  2648. Xkickm0        move.l  a0,d0
  2649. X        beq     kickm4
  2650. X        bpl.s   kickm1
  2651. X        bclr    #31,d0
  2652. X        move.l  d0,a0
  2653. X        bra.s   kickm0
  2654. Xkickm1        move.w  14(a0),d6
  2655. X        subq    #1,d6
  2656. X        lea     16(a0),a2
  2657. Xkickm2        move.l  0(a2),d0
  2658. X        bsr     hexa
  2659. X        move.l  0(a2),d0
  2660. X        move.l  4(a2),d4
  2661. X        add.l   d4,d0
  2662. X        bsr     hexa
  2663. X        move.l  d4,d0
  2664. X        clr.b   d3
  2665. X        bsr     longdec
  2666. X        bsr     newline
  2667. X        addq    #8,a2
  2668. X        dbf     d6,kickm2
  2669. X        move.l  0(a0),a0
  2670. X        bra     kickm0
  2671. Xkickm4        rts
  2672. X
  2673. Xclrcold     move.l  _SysBase,a0
  2674. X        clr.l   42(a0)
  2675. X        bra.s   chksum
  2676. Xclrcool     move.l  _SysBase,a0
  2677. X        clr.l   46(a0)
  2678. X        bra.s   chksum
  2679. Xclrwarm     move.l  _SysBase,a0
  2680. X        clr.l   50(a0)
  2681. X
  2682. Xchksum        lea     34(a0),a1
  2683. X        move    #22,d0
  2684. Xaddchk        add     (a1)+,d1
  2685. X        dbf     d0,addchk
  2686. X        not     d1
  2687. X        move.w  d1,82(a0)
  2688. X        rts
  2689. X
  2690. X;Save the command line to be repeated. If this line doesn't produce
  2691. X;any output, don't repeat it at all
  2692. Xrepeatcmd   tst.w   repeat
  2693. X        bne.s   2$
  2694. X        move.w  repeatlen(PC),d0
  2695. X        subq    #7,d0
  2696. X        move.w  d0,repeatlen
  2697. X        lea     repeatbuffer,a1
  2698. X        lea     dummy,a2
  2699. X        move.w  d0,d1
  2700. X        ext.l   d1
  2701. X1$        move.b  0(a0),(a1)+
  2702. X        move.b  (a0)+,(a2)+
  2703. X        dbf     d1,1$
  2704. X
  2705. X        clr.l   lastprinted
  2706. X        clr.b   printed
  2707. X        move.w  #1,repeat
  2708. X        bsr     cli
  2709. X        tst.b   printed
  2710. X        beq.s   2$
  2711. X        bsr     starttimer
  2712. X        rts
  2713. X2$        clr.w   repeat
  2714. X        rts
  2715. X
  2716. X;save the parameters from a 'window x y width height' call
  2717. Xsetwindow   tst.b   fromfile
  2718. X        bne.s   wiw1
  2719. Xwiw3        move.l  #wiwerr,d0
  2720. X        bra     putnam
  2721. Xwiw1        lea     window_l(PC),a3
  2722. X        moveq   #3,d5
  2723. Xwiw0        bsr     getnum
  2724. X        tst     d7
  2725. X        beq.s   wiw2
  2726. X        move.w  d2,0(a3)
  2727. X        addq    #2,a3
  2728. X        dbf     d5,wiw0
  2729. Xwiw2        rts
  2730. X
  2731. X;display ExecBase->LastAlert
  2732. Xlastalert   movem.l $100,d1-d2
  2733. X        tst.l   d1
  2734. X        bne.s   al1
  2735. X        move.l  _SysBase(PC),a0
  2736. X        movem.l 514(a0),d1-d2
  2737. Xal1        move.l  #gurutxt,d0
  2738. X        bsr     putstr
  2739. X        move.l  d1,d0
  2740. X        bsr     hexa
  2741. X        lea     out,a0
  2742. X        move.l  ptr(PC),d0
  2743. X        move.b  #'.',-1(a0,d0)
  2744. X        move.l  d2,d0
  2745. X        bsr     hexa
  2746. X        bra     newline
  2747. X
  2748. X;toggle CPUSE task list
  2749. Xusage        bchg    #0,usageflag
  2750. X        rts
  2751. X
  2752. X;toggle task-header display on/off
  2753. Xnohead        bchg    #0,headon
  2754. X        rts
  2755. X
  2756. X;toggle hide entries on/off
  2757. Xhidden        bchg    #0,hideon
  2758. X        rts
  2759. X
  2760. X;toggle sort on/off
  2761. Xsort       bchg    #0,sorton
  2762. X       rts
  2763. X
  2764. X;toggle task-ports display on/off
  2765. Xtaskports   bchg    #0,tports
  2766. Xclo1        rts
  2767. X
  2768. X;Open a library
  2769. Xopenlib     bsr     nodenam2
  2770. X        move.l  a5,a1
  2771. X        moveq   #0,d0
  2772. X        CALL    OpenLibrary,_SysBase(PC)
  2773. X        tst.l   d0
  2774. X        beq     fn5
  2775. Xopli1        rts
  2776. X
  2777. X
  2778. X;close it
  2779. Xcloselib    bsr     nodenam2
  2780. X        moveq   #0,d7
  2781. X        lea     LibNode(PC),a4
  2782. X        bsr     findnam
  2783. X        tst.b   d7
  2784. X        beq.s   clo1
  2785. X        move.l  d0,a1
  2786. X        CALL    CloseLibrary,_SysBase(PC)
  2787. X        rts
  2788. X
  2789. Xremnode     bsr     nodenam2
  2790. X        moveq   #7,d7
  2791. X        lea     TReNode(PC),a4
  2792. X        bsr     findnam
  2793. X        tst.b   d7
  2794. X        beq.s   1$
  2795. X        CALL    Disable,_SysBase(PC)
  2796. X        move.l  d0,a1
  2797. X        CALL    Remove,_SysBase(PC)
  2798. X        CALL    Enable,_SysBase(PC)
  2799. X1$        rts
  2800. X
  2801. X;end Xoper but stay in background
  2802. Xhold        addq    #4,a7
  2803. X        bra.s   instback
  2804. Xquithold    lea     in,a0
  2805. X        lea     dummy,a1
  2806. Xqh1        move.b  (a1)+,d0
  2807. X        move.b  d0,(a0)+
  2808. X        cmp.b   #10,d0
  2809. X        bne.s   qh1
  2810. X
  2811. Xinstback    tst.b   background
  2812. X        bne.s   cleanit
  2813. X        move.b  #1,background
  2814. X        bsr     installh
  2815. Xcleanit     move.l  fileptr(PC),d1
  2816. X        beq.s   ib1
  2817. X        CALL    Close,dosbase(PC)
  2818. X        clr.l   fileptr
  2819. Xib1        clr.b   running
  2820. X        bsr     killpage
  2821. X        bsr     freeblank
  2822. X        tst.l   wnptr
  2823. X        beq.s   5$
  2824. X        tst.b   ownscreen
  2825. X        bne.s   6$
  2826. X        move.l  wnptr(PC),a0
  2827. X        move.l  4(a0),window_l
  2828. X        move.l  8(a0),window_w
  2829. X6$        move.l  wnptr(PC),a0
  2830. X        CALL    CloseWindow,intuibase(PC)
  2831. X        clr.l   intuimsg
  2832. X        clr.l   wnptr
  2833. X5$        tst.b   ownscreen
  2834. X        beq.s   4$
  2835. X        move.l  screenptr(PC),a0
  2836. X        CALL    CloseScreen,intuibase(PC)
  2837. X        clr.l   screenptr
  2838. X
  2839. X4$        tst.b   iconifyon
  2840. X        beq.s   1$
  2841. X        jsr     iconify
  2842. X        bra.s   2$
  2843. X
  2844. X1$        move.l  mysignal(PC),d0
  2845. X        or.l    trapsignal(PC),d0
  2846. X        CALL    Wait,_SysBase(PC)
  2847. X2$        move.b  #1,running
  2848. X        and.l   trapsignal(PC),d0
  2849. X        beq.s   3$
  2850. X        move.b  #1,gotguru
  2851. SHAR_EOF
  2852. echo "End of archive 1 (of 3)"
  2853. # if you want to concatenate archives, remove anything after this line
  2854. exit
  2855.